### 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
ERR_THREAD_GUARD;
	Object::set_meta(p_name, p_value);
}
void Node::remove_meta(const StringName &p_name) {
	ERR_THREAD_GUARD;
	Object::remove_meta(p_name);
}
Variant Node::get_meta(const StringName &p_name, const Variant &p_default) const {
	ERR_THREAD_GUARD_V(Variant());
	return Object::get_meta(p_name, p_default);
}
void Node::get_meta_list(List<StringName> *p_list) const {
	ERR_THREAD_GUARD;
	Object::get_meta_list(p_list);
}
Error Node::emit_signalp(const StringName &p_name, const Variant **p_args, int p_argcount) {
	ERR_THREAD_GUARD_V(ERR_INVALID_PARAMETER);
	return Object::emit_signalp(p_name, p_args, p_argcount);
}
bool Node::has_signal(const StringName &p_name) const {
	ERR_THREAD_GUARD_V(false);
	return Object::has_signal(p_name);
}
void Node::get_signal_list(List<MethodInfo> *p_signals) const {
	ERR_THREAD_GUARD;
	Object::get_signal_list(p_signals);
}
void Node::get_signal_connection_list(const StringName &p_signal, List<Connection> *p_connections) const {