### Godot version

4.0.dev.d1e5903c67956707948b1de370b807e3aad395b7

### System information

macOS 13.1

### Issue description

Script classes are not regenerated project-wide after first import. See the reproduction steps below.

This is a huge problem for large games since a class may not have all of its dependencies ready by the time it comes to parsing the script, so it doesn't get registered on the first pass, and there are no other passes. The only solution is to manually open every single script and save it (potentially multiple times if there are long dependency chains).

The symptom is happening as of #70557, but the root cause was still present before that PR. If I revert that PR, open the reproduction project, and then instead of deleting the below file I empty out the `_global_script_class*` members, A and B do not regenerate (but they do if you open and save them). This has become a serious regression because the class list is no longer saved to version control, so you can end up in a situation where deleting `.godot/` results in a broken project until you manually open and save every script (for every developer, every time they delete `.godot/`).

### Steps to reproduce

1. Download an open the below minimal reproduction project.
2. Look at the generated `.godot/global_script_class_cache.cfg` file. Both A and B will be in there (good).
3. Close Godot and delete this file.
4. Open Godot again.
5. Look at the lack of a `.godot/global_script_class_cache.cfg` file. It is not regenerated (bad).
6. Open the `a.gd` script and save it.
7. Look at the generated `.godot/global_script_class_cache.cfg` file. Only A will be in there, but B will not (bad).

### Minimal reproduction project

[GlobalClassMissing.zip](https://github.com/godotengine/godot/files/10515105/GlobalClassMissing.zip)

HashSet<String> custom_features;
	HashMap<StringName, LocalVector<Pair<StringName, StringName>>> feature_overrides;
	HashMap<StringName, AutoloadInfo> autoloads;
	String project_data_dir_name;
	bool _set(const StringName &p_name, const Variant &p_value);
	bool _get(const StringName &p_name, Variant &r_ret) const;
	void _get_property_list(List<PropertyInfo> *p_list) const;
	bool _property_can_revert(const StringName &p_name) const;
	bool _property_get_revert(const StringName &p_name, Variant &r_property) const;
	static ProjectSettings *singleton;
	Error _load_settings_text(const String &p_path);
	Error _load_settings_binary(const String &p_path);
	Error _load_settings_text_or_binary(const String &p_text_path, const String &p_bin_path);
	Error _save_settings_text(const String &p_file, const RBMap<String, List<String>> &props, const CustomMap &p_custom = CustomMap(), const String &p_custom_features = String());
	Error _save_settings_binary(const String &p_file, const RBMap<String, List<String>> &props, const CustomMap &p_custom = CustomMap(), const String &p_custom_features = String());
	Error _save_custom_bnd(const String &p_file);
#ifdef TOOLS_ENABLED
	const static PackedStringArray _get_supported_features();
	const static PackedStringArray _trim_to_supported_features(const PackedStringArray &p_project_features);
#endif 
	void _convert_to_last_version(int p_from_version);
	bool _load_resource_pack(const String &p_pack, bool p_replace_files = true, int p_offset = 0);
	void _add_property_info_bind(const Dictionary &p_info);
	Error _setup(const String &p_path, const String &p_main_pack, bool p_upwards = false, bool p_ignore_override = false);
	void _add_builtin_input_map();
protected:
	static void _bind_methods();
public:
	static const int CONFIG_VERSION = 5;
	void set_setting(const String &p_setting, const Variant &p_value);