### 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
}
								undo_redo->add_do_method(anim.ptr(), "remove_track", idx);
								undo_redo->add_undo_method(anim.ptr(), "add_track", anim->track_get_type(i), idx);
								undo_redo->add_undo_method(anim.ptr(), "track_set_path", idx, track_np);
								undo_redo->add_undo_method(anim.ptr(), "track_set_interpolation_type", idx, anim->track_get_interpolation_type(i));
								for (int j = 0; j < anim->track_get_key_count(i); j++) {
									undo_redo->add_undo_method(anim.ptr(), "track_insert_key", idx, anim->track_get_key_time(i, j), anim->track_get_key_value(i, j), anim->track_get_key_transition(i, j));
								}
								ran.erase(i); 
							} else {
								
								NodePath rel_path = new_root_path.rel_path_to(found_path->value);
								NodePath new_path = NodePath(rel_path.get_names(), track_np.get_subnames(), false);
								if (new_path == track_np) {
									continue; 
								}
								undo_redo->add_do_method(anim.ptr(), "track_set_path", i, new_path);
								undo_redo->add_undo_method(anim.ptr(), "track_set_path", i, track_np);
							}
						}
					}
				}
			}
		}
	}
	for (int i = 0; i < p_base->get_child_count(); i++) {
		perform_node_renames(p_base->get_child(i), p_renames, r_rem_anims);
	}
}
void SceneTreeDock::_node_prerenamed(Node *p_node, const String &p_new_name) {