### 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)

if (p_texture.is_valid()) {
		if (!default_textures.has(p_name)) {
			default_textures[p_name] = HashMap<int, Ref<Texture2D>>();
		}
		default_textures[p_name][p_index] = p_texture;
		RS::get_singleton()->shader_set_default_texture_parameter(shader, p_name, p_texture->get_rid(), p_index);
	} else {
		if (default_textures.has(p_name) && default_textures[p_name].has(p_index)) {
			default_textures[p_name].erase(p_index);
			if (default_textures[p_name].is_empty()) {
				default_textures.erase(p_name);
			}
		}
		RS::get_singleton()->shader_set_default_texture_parameter(shader, p_name, RID(), p_index);
	}
	emit_changed();
}
Ref<Texture2D> Shader::get_default_texture_parameter(const StringName &p_name, int p_index) const {
	if (default_textures.has(p_name) && default_textures[p_name].has(p_index)) {
		return default_textures[p_name][p_index];
	}
	return Ref<Texture2D>();
}
void Shader::get_default_texture_parameter_list(List<StringName> *r_textures) const {
	for (const KeyValue<StringName, HashMap<int, Ref<Texture2D>>> &E : default_textures) {
		r_textures->push_back(E.key);
	}
}
bool Shader::is_text_shader() const {