### 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
break;
			}
			List<Node *> remove_list = editor_selection->get_selected_node_list();
			if (remove_list.is_empty()) {
				return;
			}
			if (!_validate_no_foreign()) {
				break;
			}
			bool allow_ask_delete_tracks = EDITOR_GET("docks/scene_tree/ask_before_deleting_related_animation_tracks").operator bool();
			bool has_tracks_to_delete = allow_ask_delete_tracks && _has_tracks_to_delete(edited_scene, remove_list);
			if (p_confirm_override && !has_tracks_to_delete) {
				_delete_confirm();
			} else {
				String msg;
				if (remove_list.size() > 1) {
					bool any_children = false;
					for (int i = 0; !any_children && i < remove_list.size(); i++) {
						any_children = remove_list[i]->get_child_count() > 0;
					}
					msg = vformat(any_children ? TTR("Delete %d nodes and any children?") : TTR("Delete %d nodes?"), remove_list.size());
				} else {
					if (!p_confirm_override) {
						Node *node = remove_list[0];
						if (node == editor_data->get_edited_scene_root()) {
							msg = vformat(TTR("Delete the root node \"%s\"?"), node->get_name());
						} else if (node->get_scene_file_path().is_empty() && node->get_child_count() > 0) {
							
							msg = vformat(TTR("Delete node \"%s\" and its children?"), node->get_name());
						} else {