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

#include "shader.h"
#include "core/io/file_access.h"
#include "scene/scene_string_names.h"
#include "servers/rendering/shader_language.h"
#include "servers/rendering/shader_preprocessor.h"
#include "servers/rendering_server.h"
#include "texture.h"
Shader::Mode Shader::get_mode() const {
	return mode;
}
void Shader::_dependency_changed() {
	
	_recompile();
}
void Shader::_recompile() {