### Godot version

v4.1.beta.custom_build [dbd482faa]

### System information

macOS 13.3.0 - Vulkan (Forward+) - integrated Apple M1 Pro - Apple M1 Pro (8 Threads)

### Issue description

Some editor action like changing type will replace the node by another node. Right now Node properties will still point to the old Node. 

### Steps to reproduce

1. create a scene with a root node 
2. attach a script that exports a node property
3. set the property to point to the root node 
4. change the type of the root node
5. look at the property it will error out and the editor will be blank

### Minimal reproduction project

[Test.zip](https://github.com/godotengine/godot/files/11764206/Test.zip)
with MRP you can start at step 4
FILTER_BY_TYPE = 64, 
		FILTER_BY_GROUP,
	};
	LineEdit *filter = nullptr;
	PopupMenu *filter_quick_menu = nullptr;
	TextureRect *filter_icon = nullptr;
	PopupMenu *menu = nullptr;
	PopupMenu *menu_subresources = nullptr;
	PopupMenu *menu_properties = nullptr;
	ConfirmationDialog *clear_inherit_confirm = nullptr;
	bool first_enter = true;
	void _create();
	void _do_create(Node *p_parent);
	Node *scene_root = nullptr;
	Node *edited_scene = nullptr;
	Node *pending_click_select = nullptr;
	bool tree_clicked = false;
	VBoxContainer *create_root_dialog = nullptr;
	String selected_favorite_root;
	Ref<ShaderMaterial> selected_shader_material;
	void _add_children_to_popup(Object *p_obj, int p_depth);
	void _node_reparent(NodePath p_path, bool p_keep_global_xform);
	void _do_reparent(Node *p_new_parent, int p_position_in_parent, Vector<Node *> p_nodes, bool p_keep_global_xform);
	void _set_owners(Node *p_owner, const Array &p_nodes);
	enum ReplaceOwnerMode {