### Tested versions

- Reproducible in 4.2.stable, 4.2.1.stable
- Not reproducible in 4.1.stable

### System information

Godot v4.2.1.stable - Ubuntu 22.04.3 LTS 22.04 - X11 - GLES3 (Compatibility) - NVIDIA GeForce GTX 1080 Ti (nvidia; 535.129.03) - 12th Gen Intel(R) Core(TM) i3-12100F (8 Threads)

### Issue description

Godot deletes the `.tscn` file when renaming a previously linked `.gd` file. The deleted file can't be recovered.

### Steps to reproduce

1. Create a new project.
2. Create a new scene of type Control, and save it
3. Right click the root node "Control", and select "Attach Script..."
4. Right click the root node "Control", and select "Detach Script..."
5. On the FileSystem tab right click "control.gd", and select "Rename..."
6. Move the cursor just before the dot and write "_old", the new name should be "control_old.gd"
7. Press enter

### Minimal reproduction project (MRP)

Test Project for Godot 4.2.1
You can start from step **4**.
[RenamingBugTest.zip](https://github.com/godotengine/godot/files/13677960/RenamingBugTest.zip)

translation_remapped = p_remapped;
}
ResourceLoaderText::ResourceLoaderText() :
		stream(false) {}
void ResourceLoaderText::get_dependencies(Ref<FileAccess> p_f, List<String> *p_dependencies, bool p_add_types) {
	open(p_f);
	ignore_resource_parsing = true;
	ERR_FAIL_COND(error != OK);
	while (next_tag.name == "ext_resource") {
		if (!next_tag.fields.has("type")) {
			error = ERR_FILE_CORRUPT;
			error_text = "Missing 'type' in external resource tag";
			_printerr();
			return;
		}
		if (!next_tag.fields.has("id")) {
			error = ERR_FILE_CORRUPT;
			error_text = "Missing 'id' in external resource tag";
			_printerr();
			return;
		}
		String path = next_tag.fields["path"];
		String type = next_tag.fields["type"];
		String fallback_path;
		bool using_uid = false;
		if (next_tag.fields.has("uid")) {
			
			String uidt = next_tag.fields["uid"];
			ResourceUID::ID uid = ResourceUID::get_singleton()->text_to_id(uidt);
			if (uid != ResourceUID::INVALID_ID) {