### Godot version

4.0.1stable

### System information

Windows 11

### Issue description

I had a project that previously contained multiple folders, scripts, scenes, etc. However, I decided to delete everything except for a MeshInstance3D node and its associated script in order to start something new from that. The MeshInstance3D node has a material_overwrite property set with a shader material that was originally located in one of the folders I deleted carelessly.

Now, whenever I try to save the scene, the previously deleted "shader" folder reappears in the project directory. However, when I try to click on the folder, the entire project freezes before eventually crashing. 

I created a new project and attempted to attach a Shader Material, stored in a folder, to a MeshInstance3D node. I deleted the original folder that contained the shader material, and then saved the scene. The previously deleted folder did not reappear in the project directory, I was unable to reproduce the issue and I believe that the data stored in the scene is responsible for that behaviour. I have my own project folder that make it happen consistently which I'll join.

### Steps to reproduce

Just import the project and once it is opened, press "ctrl + s" to save, that will make a folder named "Shader" appear, if you click on that folder everything will freeze before eventually crashing.

### Minimal reproduction project

[reproduction_project.zip](https://github.com/godotengine/godot/files/11255484/reproduction_project.zip)

String extension = p_path.get_extension().to_lower();
	if (extension == "gdshaderinc") {
		return "ShaderInclude";
	}
	return "";
}
Error ResourceFormatSaverShaderInclude::save(const Ref<Resource> &p_resource, const String &p_path, uint32_t p_flags) {
	Ref<ShaderInclude> shader_inc = p_resource;
	ERR_FAIL_COND_V(shader_inc.is_null(), ERR_INVALID_PARAMETER);
	String source = shader_inc->get_code();
	Error error;
	Ref<FileAccess> file = FileAccess::open(p_path, FileAccess::WRITE, &error);
	ERR_FAIL_COND_V_MSG(error, error, "Cannot save shader include '" + p_path + "'.");
	file->store_string(source);
	if (file->get_error() != OK && file->get_error() != ERR_FILE_EOF) {
		return ERR_CANT_CREATE;
	}
	return OK;
}
void ResourceFormatSaverShaderInclude::get_recognized_extensions(const Ref<Resource> &p_resource, List<String> *p_extensions) const {
	const ShaderInclude *shader_inc = Object::cast_to<ShaderInclude>(*p_resource);
	if (shader_inc != nullptr) {
		p_extensions->push_back("gdshaderinc");
	}
}
bool ResourceFormatSaverShaderInclude::recognize(const Ref<Resource> &p_resource) const {
	return p_resource->get_class_name() == "ShaderInclude"; 
}