### 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 *parent = nullptr;
		if (only_one_top_node) {
			parent = top_node->get_parent();
		} else {
			parent = top_node->get_parent()->get_parent();
		}
		_do_create(parent);
		Vector<Node *> nodes;
		for (Node *E : selection) {
			nodes.push_back(E);
		}
		
		Node *last_created = editor_selection->get_selected_node_list().front()->get();
		_do_reparent(last_created, -1, nodes, true);
	}
	scene_tree->get_scene_tree()->grab_focus();
}
void SceneTreeDock::replace_node(Node *p_node, Node *p_by_node) {
	EditorUndoRedoManager *ur = EditorUndoRedoManager::get_singleton();
	ur->create_action(TTR("Change type of node(s)"), UndoRedo::MERGE_DISABLE, p_node);
	ur->add_do_method(this, "replace_node", p_node, p_by_node, true, false);
	ur->add_do_reference(p_by_node);
	_replace_node(p_node, p_by_node, true, false);
	ur->add_undo_method(this, "replace_node", p_by_node, p_node, false, false);
	ur->add_undo_reference(p_node);
	perform_node_replace(nullptr, p_node, p_by_node);
	ur->commit_action(false);
}
void SceneTreeDock::_replace_node(Node *p_node, Node *p_by_node, bool p_keep_properties, bool p_remove_old) {