### Godot version

Godot v4.2.dev (57919beb05687cf2ee80ed0d3ccac6445c7edea9) 

### System information

Godot v4.2.dev (57919beb05687cf2ee80ed0d3ccac6445c7edea9) - Windows 10.0.19045 - Vulkan (Forward+) - dedicated NVIDIA GeForce GTX 970 (NVIDIA; 31.0.15.3179) - Intel(R) Core(TM) i7-4790K CPU @ 4.00GHz (8 Threads)

### Issue description

I already have a possible PR incoming to fix this issue, but I'm creating this report in case the fix needed is more complex.

Unlike normal shader uniforms set using `ShaderMaterial.set_shader_parameter()`, instance uniforms set using `GeometryInstance3D.set_instance_shader_parameter()` are is some situations updated one or more frames later. This causes all kinds of headaches as you have to add a sentinel value check (or some other similar workaround) to your shaders to see if the instance uniform has been updated yet.

### Steps to reproduce

Download the MRP project and run it (it's a modified MRP from https://github.com/godotengine/godot/issues/79167 where I noticed this issue). Press and hold left mouse button and you can "paint" and create new cubes on the ground where the raycast hits. Note that all newly created cubes have a black color during their first frame of lifetime. After the first frame their instance uniform is updated and the cube gets it's real color. Hopefully, this should be pretty easy to see when dragging the mouse.

### Minimal reproduction project

[InstanceUniformUpdateBug.zip](https://github.com/godotengine/godot/files/12078755/InstanceUniformUpdateBug.zip)

Instance *instance = instance_owner.get_or_null(p_instance);
	ERR_FAIL_COND(!instance);
	Scenario *scenario = instance->scenario;
	if (instance->base_type != RS::INSTANCE_NONE) {
		
		if (scenario && instance->indexer_id.is_valid()) {
			_unpair_instance(instance);
		}
		if (instance->mesh_instance.is_valid()) {
			RSG::mesh_storage->mesh_instance_free(instance->mesh_instance);
			instance->mesh_instance = RID();
			
		}
		switch (instance->base_type) {
			case RS::INSTANCE_MESH:
			case RS::INSTANCE_MULTIMESH:
			case RS::INSTANCE_PARTICLES: {
				InstanceGeometryData *geom = static_cast<InstanceGeometryData *>(instance->base_data);
				scene_render->geometry_instance_free(geom->geometry_instance);
			} break;
			case RS::INSTANCE_LIGHT: {
				InstanceLightData *light = static_cast<InstanceLightData *>(instance->base_data);
				if (scenario && instance->visible && RSG::light_storage->light_get_type(instance->base) != RS::LIGHT_DIRECTIONAL && light->bake_mode == RS::LIGHT_BAKE_DYNAMIC) {
					scenario->dynamic_lights.erase(light->instance);
				}