Repository: godot
Issue: Plugins can break the rewrite of project.godot file when exiting editor 
Labels: bug,needs testing,topic:export

### Godot version

3.4.4

### System information

Macbook m1 pro Monterey 12.4

### Issue description

Exporting a project pck seems to remove global script classes from the project.godot file. Same behaviour is observed both when exporting ios pck and full android ipa. However it is not observed when deploying to android from editor.

Maybe related to https://github.com/godotengine/godot/pull/26335 ?



### Steps to reproduce

Steps:

1. Export project successfully where class_name is used example:

```
/$editor_folder/$exec --path project --no-window --export-pack ios ../export/ios/gameone.pck
arguments
0: ./editor/godot.osx.tools.arm64
1: --path
2: project
3: --no-window
4: --export-pack
5: ios
6: ../export/ios/gameone.pck
Current path: /Users/--------/repos/gameone
Godot Engine v3.4.4.stable.custom_build - https://godotengine.org

***
        savepack: step 102: Storing File: res://zen/zen_menu.gd.remap
        savepack: step 102: Storing File: res://zen/zen_piece.gd.remap
        savepack: step 102: Storing File: res://icon.png
        savepack: step 102: Storing File: res://project.binary
savepack: end

```

3. Project.godot is changed, now missing class_name references 
```
git diff project.godot
diff --git a/project/project.godot b/project/project.godot
index d5a39d0..3b79247 100644
--- a/project/project.godot
+++ b/project/project.godot
@@ -8,64 +8,6 @@
 
 config_version=4
 
-_global_script_classes=[ {
-"base": "GraphNode",
-"class": "CommonNode",
-"language": "GDScript",
-"path": "res://addons/project_map/pm_common_node.gd"
-}, {
-"base": "Control",
-"class": "base_recruit",
-"language": "GDScript",
-"path": "res://game_recruit.gd"
-}, {
-"base": "Control",
-"class": "game",
-"language": "GDScript",
-"path": "res://game.gd"
-}, {
-"base": "Control",
-"class": "game_arena",
-"language": "GDScript",
-"path": "res://game_arena.gd"
-}, {
-"base": "ColorRect",
-"class": "history_item",
-"language": "GDScript",
-"path": "res://scenes/history_item.gd"
-}, {
-"base": "Node",
-"class": "item_ability",
-"language": "GDScript",
-"path": "res://items/item_ability.gd"
-}, {
-"base": "Resource",
-"class": "piece_data",
-"language": "GDScript",
-"path": "res://zen/resource_piece.gd"
-}, {
-"base": "ColorRect",
-"class": "top_bar_game",
-"language": "GDScript",
-"path": "res://scenes/topbar.gd"
-}, {
-"base": "ColorRect",
-"class": "unit",
-"language": "GDScript",
-"path": "res://units/unit.gd"
-} ]
-_global_script_class_icons={
-"CommonNode": "",
-"base_recruit": "",
-"game": "",
-"game_arena": "",
-"history_item": "",
-"item_ability": "",
-"piece_data": "",
-"top_bar_game": "",
-"unit": ""
```

4. Repeating step 1 then gives error since project is now broken due to missing script classes

```
        savepack: step 102: Storing File: res://project.binary
savepack: end
SCRIPT ERROR: Parse Error: Expected a constant expression.
          at: GDScript::reload (res://zen/zen_piece.gd:31)
ERROR: Method failed. Returning: ERR_PARSE_ERROR
   at: reload (modules/gdscript/gdscript.cpp:577)
SCRIPT ERROR: Parse Error: The identifier "piece_data" isn't declared in the current scope.
          at: GDScript::reload (res://zen/rules.gd:46)
ERROR: Method failed. Returning: ERR_PARSE_ERROR
   at: reload (modules/gdscript/gdscript.cpp:577)
```




### Minimal reproduction project

_No response_