### Godot version

v4.1.rc1.official [1f9e540f1]

### System information

Windows 10

### Issue description

Attempting to reorder the children of a TabContainer results in an unintended ordering and incorrect undo states.

Also happens in v4.0.3.stable.official [5222a99f5].

https://github.com/godotengine/godot/assets/3820082/2c2458e3-88ad-46d9-8a04-f289a049984a



### Steps to reproduce

1. Add a new TabContainer
2. Add a few children to it
3. Drag and drop to erroneously reorder them
4. Attempt to undo the change

### Minimal reproduction project

N/A
Node *node = nodes.front()->get();
			Node *root = get_tree()->get_edited_scene_root();
			if (node == root) {
				return;
			}
			
			if (root->get_scene_inherited_state().is_valid()) {
				accept->set_text(TTR("Can't reparent nodes in inherited scenes, order of nodes can't change."));
				accept->popup_centered();
				return;
			}
			if (node->get_owner() != root) {
				accept->set_text(TTR("Node must belong to the edited scene to become root."));
				accept->popup_centered();
				return;
			}
			if (!node->get_scene_file_path().is_empty()) {
				accept->set_text(TTR("Instantiated scenes can't become root"));
				accept->popup_centered();
				return;
			}
			EditorUndoRedoManager *undo_redo = EditorUndoRedoManager::get_singleton();
			undo_redo->create_action(TTR("Make node as Root"));
			undo_redo->add_do_method(node->get_parent(), "remove_child", node);
			undo_redo->add_do_method(EditorNode::get_singleton(), "set_edited_scene", node);
			undo_redo->add_do_method(node, "add_child", root, true);
			undo_redo->add_do_method(node, "set_scene_file_path", root->get_scene_file_path());
			undo_redo->add_do_method(root, "set_scene_file_path", String());
			undo_redo->add_do_method(node, "set_owner", (Object *)nullptr);
			undo_redo->add_do_method(root, "set_owner", node);