### Godot version

v4.1.stable.mono.official [970459615]

### System information

Godot v4.1.stable.mono - Windows 10.0.22621 - Vulkan (Forward+) - dedicated NVIDIA GeForce RTX 3090 (NVIDIA; 31.0.15.3640)

### Issue description

With the following scene structure:

- Containing Scene
    - Main 3D Scene
    - Subviewport
        - Another 3D Scene
    - UI control container
        - TextureButton referencing the Subviewport via a ViewportTexture

If the containing scene is itself instanced as a child of another scene within the project, and that other scene is open, closing and re-opening the containing scene will generate several errors of the form `scene/main/viewport.cpp:143 - Viewport Texture must be set to use it.` If the button is visible, the editor will also generate infinite errors of the form

```
Texture (binding: 0) should provide one ID referencing a texture (IDs provided: 0).
drivers/vulkan/rendering_device_vulkan.cpp:7208 - Condition "!uniform_set" is true.
```

Additionally, the TextureButtons will not display the viewport contents.

These errors do not appear, and the TextureButtons will display correctly, if the containing scene is not instanced in another scene in the project, or if the scene in which the containing scene is instanced is not currently open.

May (?) be related to #66247 and/or #69469.

### Steps to reproduce

1. Reproduce the scene structure as described above, or open the attached MRP
2. If the scene instancing the containing scene (`main.tscn` in the attached MRP) is not open, open it
3. If the subviewport/button's containing scene (`game_screen.tscn` in the attached MRP) is not open, open it
4. Close the containing scene
5. Open the containing scene
6. If necessary, select a UI control node to make the button visible.

### Minimal reproduction project

`game_screen.tscn` is the containing scene for the Subviewport and TextureButton. `game_screen.tscn` is instanced as a child of `main.tscn` in `SubviewportBug.zip`. Closing and reopening `game_scene.tscn` in the version from `SubviewportBug.zip` generates errors as described above, until the editor is restarted or an entirely new ViewportTexture is assigned to the button.

In `SubviewportBugNoError.zip`, `game_screen.tscn` is not instanced as a child of any other scene. Closing and reopening `game_scene.tscn` in this version does not generate errors.

Alternatively, close `main.tscn` in the `SubviewportBug.zip` version, and closing and reopening `game_scene.tscn` will not generate errors.

[SubviewportBug.zip](https://github.com/godotengine/godot/files/11986495/SubviewportBug.zip)
[SubviewportBugNoError.zip](https://github.com/godotengine/godot/files/11986496/SubviewportBugNoError.zip)

bool get_positional_shadow_atlas_16_bits() const;
	void set_positional_shadow_atlas_quadrant_subdiv(int p_quadrant, PositionalShadowAtlasQuadrantSubdiv p_subdiv);
	PositionalShadowAtlasQuadrantSubdiv get_positional_shadow_atlas_quadrant_subdiv(int p_quadrant) const;
	void set_msaa_2d(MSAA p_msaa);
	MSAA get_msaa_2d() const;
	void set_msaa_3d(MSAA p_msaa);
	MSAA get_msaa_3d() const;
	void set_screen_space_aa(ScreenSpaceAA p_screen_space_aa);
	ScreenSpaceAA get_screen_space_aa() const;
	void set_use_taa(bool p_use_taa);
	bool is_using_taa() const;
	void set_scaling_3d_mode(Scaling3DMode p_scaling_3d_mode);
	Scaling3DMode get_scaling_3d_mode() const;
	void set_scaling_3d_scale(float p_scaling_3d_scale);
	float get_scaling_3d_scale() const;
	void set_fsr_sharpness(float p_fsr_sharpness);
	float get_fsr_sharpness() const;
	void set_texture_mipmap_bias(float p_texture_mipmap_bias);
	float get_texture_mipmap_bias() const;
	void set_use_debanding(bool p_use_debanding);
	bool is_using_debanding() const;
	void set_mesh_lod_threshold(float p_pixels);
	float get_mesh_lod_threshold() const;
	void set_use_occlusion_culling(bool p_us_occlusion_culling);
	bool is_using_occlusion_culling() const;
	Vector2 get_camera_coords(const Vector2 &p_viewport_coords) const;
	Vector2 get_camera_rect_size() const;
	void push_text_input(const String &p_text);
	void push_input(const Ref<InputEvent> &p_event, bool p_local_coords = false);
#ifndef DISABLE_DEPRECATED