### Godot version

v4.0 rc6

### System information

Windows 10

### Issue description

When using a ViewportTexture from a SubViewport on a TextureRect, it throws errors after running the scene once and then switching scenes in the editor.
![Pasted image 20230227212626](https://user-images.githubusercontent.com/44676282/221680047-984fa03e-33d1-4856-9a7f-1700b28423cf.png)


### Steps to reproduce

Run the canvas-scene once.
Switch to another scene in the editor.
Switch back to the canvas-scene

### Minimal reproduction project

[ViewportTextureError.zip](https://github.com/godotengine/godot/files/10844099/ViewportTextureError.zip)

#ifdef TOOLS_ENABLED
	uint64_t last_modified_time = 0;
	uint64_t import_last_modified_time = 0;
	String import_path;
#endif
	bool local_to_scene = false;
	friend class SceneState;
	Node *local_scene = nullptr;
	SelfList<Resource> remapped_list;
protected:
	virtual void _resource_path_changed();
	static void _bind_methods();
	void _set_path(const String &p_path);
	void _take_over_path(const String &p_path);
public:
	static Node *(*_get_local_scene_func)(); 
	static void (*_update_configuration_warning)(); 
	void update_configuration_warning();
	virtual bool editor_can_reload_from_file();
	virtual void reset_state(); 
	virtual Error copy_from(const Ref<Resource> &p_resource);
	virtual void reload_from_file();
	void emit_changed();
	void connect_changed(const Callable &p_callable, uint32_t p_flags = 0);
	void disconnect_changed(const Callable &p_callable);
	void set_name(const String &p_name);
	String get_name() const;
	virtual void set_path(const String &p_path, bool p_take_over = false);
	String get_path() const;
	_FORCE_INLINE_ bool is_built_in() const { return path_cache.is_empty() || path_cache.contains("::") || path_cache.begins_with("local://"); }