Repository: godotengine/godot (language: cpp)

Issue:
Autoloaded scene loses their built-in script when upgrading from 4.3 to 4.4
### Tested versions

- Reproducible: 4.4 beta 4, 4.4 rc 2 and 4.4 rc 3
- Not Reproducible: 4.4 beta 3

### System information

Godot v4.4.rc3 - Windows 10 (build 19045) - Multi-window, 2 monitors - Vulkan (Forward+) - dedicated AMD Radeon RX 580 2048SP (Advanced Micro Devices, Inc.; 31.0.21921.1000) - AMD Ryzen 5 3600 6-Core Processor (12 threads)

### Issue description

When i did the upgrade of a project made in 4.3 stable to 4.4 rc 2 after the uid update and restart i noticed a scene that also was an autoload loses the built-in script and was replaced for an empty built-in script. 

This is the mrp in 4.3 stable, everything ok:

https://github.com/user-attachments/assets/52912b63-1ef5-4267-b560-1f9c3ffee361

<br>

After open in 4,4 rc 2 for the first time and do the `restart and upgrade` process, the script attached to my autoload scene was empty, the `ctrl + left` click in `BulletManager` inside the script doesn't work and `ctrl + left` click on the function name leads to another script, the function docs tooltip still working.

https://github.com/user-attachments/assets/c7feda51-9f16-454b-b819-47fecda7151f

<br>

But if i restart again, the built-in script attached still empty, `ctrl + left click` in `BulletManager` inside the script works but now hover or press `ctrl` while hovering the functon name trigger this error: `modules/gdscript/gdscript_editor.cpp:3838 - Condition "!ClassDB::class_exists(class_name)" is true. Returning: ERR_BUG` and the doc tooltips doesn't work anymore.

https://github.com/user-attachments/assets/0533b64e-ab49-45ff-9ecf-1f6acaee9638

<br>

Bisecting points to pr #102636 as the culprit, CC @amarsero

![Image](https://github.com/user-attachments/assets/710f8014-e6d4-4dd4-811e-cdda88ff78c5)

### Steps to reproduce

1. Download the MRP.
2. Open in Godot 4.4 beta 4 or higher.
3. Do the `Restart and Upgrade`.
4. After restart, open the `BulletManager.tscn` and look the script, will be empty.
5. `Ctrl + left click` the function name in the `Scenes/Player/player.tscn` script in line 28, will open a different script from the attached one in the `BulletManager.tscn`, but this one contain all the data.
6. Restart again and try do the same as above.

### Minimal reproduction project (MRP)

[test_project.zip](https://github.com/user-attachments/files/19034051/test_project.zip)


Discussion / hints:
I'll look into it!

Fix patch:
diff --git a/editor/uid_upgrade_tool.cpp b/editor/uid_upgrade_tool.cpp
index 4d888ac2e728..1d44471c09d8 100644
--- a/editor/uid_upgrade_tool.cpp
+++ b/editor/uid_upgrade_tool.cpp
@@ -74,7 +74,7 @@ void UIDUpgradeTool::finish_upgrade() {
 
 	int step = 0;
 	for (const String &file_path : resave_paths) {
-		Ref<Resource> res = ResourceLoader::load(file_path);
+		Ref<Resource> res = ResourceLoader::load(file_path, "", ResourceFormatLoader::CACHE_MODE_REPLACE);
 		ep.step(TTR("Attempting to re-save ") + file_path, step++);
 		if (res.is_valid()) {
 			ResourceSaver::save(res);


Test patch: