### Godot version

v4.0.beta.custom_build [291add339]

### System information

Windows 10, Forward+, NVIDIA GeForce GTX 1050 Ti (31.0.15.1694)

### Issue description

I was testing if #69669 was solved by #70418, which it seemed to be. However, I got a wall of errors at the same time.

In the minimal reproduction project below in this Issue, I get errors when instantiating many of the same `GPUParticle2D` scene. In my earlier Godot 4 build (v4.0.beta.custom_build [2a04b18d3]) I did not get any errors (but got the occasional artifact as was my original issue in #69669).

I suspect the PR #70418 solved the artifact, but possibly introduced new bugs. However, I have not specifically built Godot with, and without the PR in question.

I believe this is the start and end of the errors - after which they repeat.
![wall_of_errors](https://user-images.githubusercontent.com/10490534/209046500-9813150c-d6e4-4a11-8e62-79d370d07009.png)

### Steps to reproduce

- Create a GPUParticle2D scene
- Instantiate the scene several times
- Observe the debugger get flooded with errors

### Minimal reproduction project

This project only instantiates default GPUParticle2D scenes with a default particle material.
[GPU_Particle_Creation_Bug.zip](https://github.com/godotengine/godot/files/10283416/GPU_Particle_Creation_Bug.zip)

p_size = nearest_power_of_2_templated(p_size);
	if (p_size == state.shadow_texture_size) {
		return;
	}
	state.shadow_texture_size = p_size;
	if (state.shadow_fb.is_valid()) {
		RD::get_singleton()->free(state.shadow_texture);
		RD::get_singleton()->free(state.shadow_depth_texture);
		state.shadow_fb = RID();
		{
			
			RD::TextureFormat tf;
			tf.texture_type = RD::TEXTURE_TYPE_2D;
			tf.width = 4;
			tf.height = 4;
			tf.usage_bits = RD::TEXTURE_USAGE_SAMPLING_BIT;
			tf.format = RD::DATA_FORMAT_R32_SFLOAT;
			state.shadow_texture = RD::get_singleton()->texture_create(tf, RD::TextureView());
		}
	}
}
RendererCanvasRenderRD::~RendererCanvasRenderRD() {
	RendererRD::MaterialStorage *material_storage = RendererRD::MaterialStorage::get_singleton();
	
	material_storage->material_free(default_canvas_group_material);
	material_storage->shader_free(default_canvas_group_shader);
	material_storage->material_free(default_clip_children_material);
	material_storage->shader_free(default_clip_children_shader);