### 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
}
		String propertyname = E.name;
		Variant old_variant = p_base->get(propertyname);
		Variant updated_variant = old_variant;
		String warn_message;
		if (_check_node_recursive(updated_variant, p_node, p_by_node, E.hint_string, warn_message)) {
			EditorUndoRedoManager *undo_redo = EditorUndoRedoManager::get_singleton();
			undo_redo->add_do_property(p_base, propertyname, updated_variant);
			undo_redo->add_undo_property(p_base, propertyname, old_variant);
			p_base->set(propertyname, updated_variant);
			if (!warn_message.is_empty()) {
				String node_path = (String(edited_scene->get_name()) + "/" + String(edited_scene->get_path_to(p_base))).trim_suffix("/.");
				WARN_PRINT(warn_message + vformat(TTR("Removing the node from variable \"%s\" on node \"%s\"."), propertyname, node_path));
			}
		}
	}
	for (int i = 0; i < p_base->get_child_count(); i++) {
		perform_node_replace(p_base->get_child(i), p_node, p_by_node);
	}
}
bool SceneTreeDock::_check_node_recursive(Variant &r_variant, Node *p_node, Node *p_by_node, const String type_hint, String &r_warn_message) {
	switch (r_variant.get_type()) {
		case Variant::OBJECT: {
			if (p_node == r_variant) {
				if (p_by_node->is_class(type_hint) || EditorNode::get_singleton()->is_object_of_custom_type(p_by_node, type_hint)) {
					r_variant = p_by_node;
				} else {
					r_variant = memnew(Object);
					r_warn_message = vformat(TTR("The node's new type is incompatible with an exported variable (expected %s, but type is %s)."), type_hint, p_by_node->get_class());
				}