### Godot version

4.0.3-stable

### System information

Windows 10

### Issue description

In some projects ViewportTexture remains pink and doesn't render viewport content after upgrading from 4.0.2-stable to 4.0.3-stable. If a pair of files viewport.h/viewport.cpp are downgraded back to what they were in 4.0.2-stable, problem goes away.

This is how it looks in 4.0.3-stable:
![4 0 3_stable_viewport_4 0 3](https://github.com/godotengine/godot/assets/1449921/44c191a9-4b67-4b02-90b6-4ab615f62a73)

And this is how it looks if viewport.h/viewport.cpp are downgraded back to what they were in 4.0.2-stable.
![4 0 3_stable_viewport_4 0 2](https://github.com/godotengine/godot/assets/1449921/f5abc605-f129-4222-9c0e-e9a07621dd9d)



### Steps to reproduce

Unfortunately, I cannot come up wit a simple demo project reproducing the problem. It exists in some projects and doesn't exist in others.


### Minimal reproduction project

Cannot produce a simple project reproducing the problem. In simple projects it works fine.
BIND_ENUM_CONSTANT(SDF_OVERSIZE_MAX);
	BIND_ENUM_CONSTANT(SDF_SCALE_100_PERCENT);
	BIND_ENUM_CONSTANT(SDF_SCALE_50_PERCENT);
	BIND_ENUM_CONSTANT(SDF_SCALE_25_PERCENT);
	BIND_ENUM_CONSTANT(SDF_SCALE_MAX);
	BIND_ENUM_CONSTANT(VRS_DISABLED);
	BIND_ENUM_CONSTANT(VRS_TEXTURE);
	BIND_ENUM_CONSTANT(VRS_XR);
	BIND_ENUM_CONSTANT(VRS_MAX);
}
void Viewport::_validate_property(PropertyInfo &p_property) const {
	if (vrs_mode != VRS_TEXTURE && (p_property.name == "vrs_texture")) {
		p_property.usage = PROPERTY_USAGE_NO_EDITOR;
	}
}
Viewport::Viewport() {
	world_2d = Ref<World2D>(memnew(World2D));
	world_2d->register_viewport(this);
	viewport = RenderingServer::get_singleton()->viewport_create();
	texture_rid = RenderingServer::get_singleton()->viewport_get_texture(viewport);
	default_texture.instantiate();
	default_texture->vp = const_cast<Viewport *>(this);
	viewport_textures.insert(default_texture.ptr());
	default_texture->proxy = RS::get_singleton()->texture_proxy_create(texture_rid);
	canvas_layers.insert(nullptr); // This eases picking code (interpreted as the canvas of the Viewport).
	set_positional_shadow_atlas_size(positional_shadow_atlas_size);
	for (int i = 0; i < 4; i++) {
		positional_shadow_atlas_quadrant_subdiv[i] = SHADOW_ATLAS_QUADRANT_SUBDIV_MAX;
	}
	set_positional_shadow_atlas_quadrant_subdiv(0, SHADOW_ATLAS_QUADRANT_SUBDIV_4);