### 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)

SubWindowResize subwindow_resize_mode;
		Rect2i subwindow_resize_from_rect;
		Vector<SubWindow> sub_windows; 
	} gui;
	DefaultCanvasItemTextureFilter default_canvas_item_texture_filter = DEFAULT_CANVAS_ITEM_TEXTURE_FILTER_LINEAR;
	DefaultCanvasItemTextureRepeat default_canvas_item_texture_repeat = DEFAULT_CANVAS_ITEM_TEXTURE_REPEAT_DISABLED;
	bool disable_input = false;
	bool _gui_call_input(Control *p_control, const Ref<InputEvent> &p_input);
	void _gui_call_notification(Control *p_control, int p_what);
	void _gui_sort_roots();
	Control *_gui_find_control_at_pos(CanvasItem *p_node, const Point2 &p_global, const Transform2D &p_xform);
	void _gui_input_event(Ref<InputEvent> p_event);
	void _perform_drop(Control *p_control = nullptr, Point2 p_pos = Point2());
	void _gui_cleanup_internal_state(Ref<InputEvent> p_event);
	void _push_unhandled_input_internal(const Ref<InputEvent> &p_event);
	Ref<InputEvent> _make_input_local(const Ref<InputEvent> &ev);
	friend class Control;
	List<Control *>::Element *_gui_add_root_control(Control *p_control);
	void _gui_remove_root_control(List<Control *>::Element *RI);
	String _gui_get_tooltip(Control *p_control, const Vector2 &p_pos, Control **r_tooltip_owner = nullptr);
	void _gui_cancel_tooltip();
	void _gui_show_tooltip();
	void _gui_remove_control(Control *p_control);
	void _gui_hide_control(Control *p_control);
	void _gui_force_drag(Control *p_base, const Variant &p_data, Control *p_control);
	void _gui_set_drag_preview(Control *p_base, Control *p_control);
	Control *_gui_get_drag_preview();
	void _gui_remove_focus_for_window(Node *p_window);
	void _gui_unfocus_control(Control *p_control);
	bool _gui_control_has_focus(const Control *p_control);