### Godot version

v4.0.3.stable.official [5222a99f5]

### System information

Debian 11 | Vulkan API 1.2.175 - Forward+ - Using Vulkan Device #0: NVIDIA - NVIDIA GeForce GTX 1080 | nvidia-driver 470.182.03-1 from Debian 11 | Intel(R) Core(TM) i7-8700K CPU @ 3.70GHz

### Issue description

Re-opening a scene in the editor that contains a `TextureRect` with a `ViewportTexture` and is `preload`ed in an unopened script produces the following error repeatedly and rapidly (about 200 times per second) until either the scene is closed or the script is also opened.

>ERROR: Texture (binding: 0) should provide one ID referencing a texture (IDs provided: 0).
>   at: uniform_set_create (drivers/vulkan/rendering_device_vulkan.cpp:5501)
>ERROR: Condition "!uniform_set" is true.
>   at: draw_list_bind_uniform_set (drivers/vulkan/rendering_device_vulkan.cpp:7191)
>ERROR: Uniforms were never supplied for set (3) at the time of drawing, which are required by the pipeline
>   at: draw_list_draw (drivers/vulkan/rendering_device_vulkan.cpp:7346)

### Steps to reproduce

1. Open the attached reproduction project
2. Open demo.tscn
3. Close demo.tscn
4. Open demo.tscn again

Do **not** open other.gd beforehand. Doing so will stop the problem from occurring.

### Minimal reproduction project

[reproduce_uniform_not_set.zip](https://github.com/godotengine/godot/files/11681977/reproduce_uniform_not_set.zip)

ClassDB::bind_method(D_METHOD("set_world_2d", "world_2d"), &Viewport::set_world_2d);
	ClassDB::bind_method(D_METHOD("get_world_2d"), &Viewport::get_world_2d);
	ClassDB::bind_method(D_METHOD("find_world_2d"), &Viewport::find_world_2d);
	ClassDB::bind_method(D_METHOD("set_canvas_transform", "xform"), &Viewport::set_canvas_transform);
	ClassDB::bind_method(D_METHOD("get_canvas_transform"), &Viewport::get_canvas_transform);
	ClassDB::bind_method(D_METHOD("set_global_canvas_transform", "xform"), &Viewport::set_global_canvas_transform);
	ClassDB::bind_method(D_METHOD("get_global_canvas_transform"), &Viewport::get_global_canvas_transform);
	ClassDB::bind_method(D_METHOD("get_final_transform"), &Viewport::get_final_transform);
	ClassDB::bind_method(D_METHOD("get_screen_transform"), &Viewport::get_screen_transform);
	ClassDB::bind_method(D_METHOD("get_visible_rect"), &Viewport::get_visible_rect);
	ClassDB::bind_method(D_METHOD("set_transparent_background", "enable"), &Viewport::set_transparent_background);
	ClassDB::bind_method(D_METHOD("has_transparent_background"), &Viewport::has_transparent_background);
	ClassDB::bind_method(D_METHOD("set_use_hdr_2d", "enable"), &Viewport::set_use_hdr_2d);
	ClassDB::bind_method(D_METHOD("is_using_hdr_2d"), &Viewport::is_using_hdr_2d);
	ClassDB::bind_method(D_METHOD("set_msaa_2d", "msaa"), &Viewport::set_msaa_2d);
	ClassDB::bind_method(D_METHOD("get_msaa_2d"), &Viewport::get_msaa_2d);
	ClassDB::bind_method(D_METHOD("set_msaa_3d", "msaa"), &Viewport::set_msaa_3d);
	ClassDB::bind_method(D_METHOD("get_msaa_3d"), &Viewport::get_msaa_3d);
	ClassDB::bind_method(D_METHOD("set_screen_space_aa", "screen_space_aa"), &Viewport::set_screen_space_aa);
	ClassDB::bind_method(D_METHOD("get_screen_space_aa"), &Viewport::get_screen_space_aa);
	ClassDB::bind_method(D_METHOD("set_use_taa", "enable"), &Viewport::set_use_taa);
	ClassDB::bind_method(D_METHOD("is_using_taa"), &Viewport::is_using_taa);
	ClassDB::bind_method(D_METHOD("set_use_debanding", "enable"), &Viewport::set_use_debanding);
	ClassDB::bind_method(D_METHOD("is_using_debanding"), &Viewport::is_using_debanding);
	ClassDB::bind_method(D_METHOD("set_use_occlusion_culling", "enable"), &Viewport::set_use_occlusion_culling);
	ClassDB::bind_method(D_METHOD("is_using_occlusion_culling"), &Viewport::is_using_occlusion_culling);
	ClassDB::bind_method(D_METHOD("set_debug_draw", "debug_draw"), &Viewport::set_debug_draw);
	ClassDB::bind_method(D_METHOD("get_debug_draw"), &Viewport::get_debug_draw);
	ClassDB::bind_method(D_METHOD("get_render_info", "type", "info"), &Viewport::get_render_info);