### 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
List<Node *>::Element *first_selected = editor_selection->get_selected_node_list().front();
			if (first_selected == nullptr) {
				return;
			}
			if (first_selected->get() == EditorNode::get_singleton()->get_edited_scene()) {
				
				editor_selection->remove_node(first_selected->get());
				first_selected = editor_selection->get_selected_node_list().front();
				if (first_selected == nullptr) {
					return;
				}
			}
			bool enabling = !first_selected->get()->is_unique_name_in_owner();
			List<Node *> full_selection = editor_selection->get_full_selected_node_list();
			EditorUndoRedoManager *undo_redo = EditorUndoRedoManager::get_singleton();
			if (enabling) {
				Vector<Node *> new_unique_nodes;
				Vector<StringName> new_unique_names;
				Vector<StringName> cant_be_set_unique_names;
				for (Node *node : full_selection) {
					if (node->is_unique_name_in_owner()) {
						continue;
					}
					StringName name = node->get_name();
					if (new_unique_names.find(name) != -1 || get_tree()->get_edited_scene_root()->get_node_or_null(UNIQUE_NODE_PREFIX + String(name)) != nullptr) {
						cant_be_set_unique_names.push_back(name);
					} else {
						new_unique_nodes.push_back(node);
						new_unique_names.push_back(name);