### Godot version

4.0.2 & 4.0.3 RC1

### System information

Windows 10, Vulkan API 1.3.224, NVIDIA RTX A2000 Laptop GPU

### Issue description

When saving a scene containing another recently saved instatiated scene with one or more resources being local to scene, Godot changes the affected Resource ID. This only happens if the Node containing the resource being local to scene is the root.
This Occurance is espacially problematic when working in a team with any source control solution.

### Steps to reproduce

- Create a new scene containing a MeshInstance3D node and make it the scene root.
- Assign a mesh and set the property resource_local_to_scene to true
- Create a second scene and instantiate the scene containing the MeshInstance3D node
- Without needing to change either scenes, save the MeshInstance3D scene (or any other instantiated child scene) first, then the scene where the MeshInstance3D scene is initiated


### Minimal reproduction project

[IdChange.zip](https://github.com/godotengine/godot/files/11380909/IdChange.zip)
In this example saving either child scene before the main scene will cause the error, but only the IDs of the Node labeled "ChanginIDs" will change.
return state->get_bundled_scene();
}
Error PackedScene::pack(Node *p_scene) {
	return state->pack(p_scene);
}
void PackedScene::clear() {
	state->clear();
}
void PackedScene::reload_from_file() {
	String path = get_path();
	if (!path.is_resource_file()) {
		return;
	}
	Ref<PackedScene> s = ResourceLoader::load(ResourceLoader::path_remap(path), get_class(), ResourceFormatLoader::CACHE_MODE_IGNORE);
	if (!s.is_valid()) {
		return;
	}
	
	Ref<SceneState> loaded_state = s->get_state();
	
	
	s->recreate_state();
	
	copy_from(s);
	
	state->copy_from(loaded_state);
}
bool PackedScene::can_instantiate() const {