### 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
#ifdef DEBUG_ENABLED
	virtual void set_script(const Variant &p_script) override;
	virtual Variant get_script() const override;
	virtual bool has_meta(const StringName &p_name) const override;
	virtual void set_meta(const StringName &p_name, const Variant &p_value) override;
	virtual void remove_meta(const StringName &p_name) override;
	virtual Variant get_meta(const StringName &p_name, const Variant &p_default = Variant()) const override;
	virtual void get_meta_list(List<StringName> *p_list) const override;
	virtual Error emit_signalp(const StringName &p_name, const Variant **p_args, int p_argcount) override;
	virtual bool has_signal(const StringName &p_name) const override;
	virtual void get_signal_list(List<MethodInfo> *p_signals) const override;
	virtual void get_signal_connection_list(const StringName &p_signal, List<Connection> *p_connections) const override;
	virtual void get_all_signal_connections(List<Connection> *p_connections) const override;
	virtual int get_persistent_signal_connection_count() const override;
	virtual void get_signals_connected_to_this(List<Connection> *p_connections) const override;
	virtual Error connect(const StringName &p_signal, const Callable &p_callable, uint32_t p_flags = 0) override;
	virtual void disconnect(const StringName &p_signal, const Callable &p_callable) override;
	virtual bool is_connected(const StringName &p_signal, const Callable &p_callable) const override;
#endif
	Node();
	~Node();
};
VARIANT_ENUM_CAST(Node::DuplicateFlags);
VARIANT_ENUM_CAST(Node::ProcessMode);
VARIANT_ENUM_CAST(Node::ProcessThreadGroup);
VARIANT_BITFIELD_CAST(Node::ProcessThreadMessages);
VARIANT_ENUM_CAST(Node::InternalMode);
typedef HashSet<Node *, Node::Comparator> NodeSet;
template <typename... VarArgs>
Error Node::rpc(const StringName &p_method, VarArgs... p_args) {