### 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
NOTIFICATION_APPLICATION_FOCUS_IN = MainLoop::NOTIFICATION_APPLICATION_FOCUS_IN,
		NOTIFICATION_APPLICATION_FOCUS_OUT = MainLoop::NOTIFICATION_APPLICATION_FOCUS_OUT,
		NOTIFICATION_TEXT_SERVER_CHANGED = MainLoop::NOTIFICATION_TEXT_SERVER_CHANGED,
		
		NOTIFICATION_EDITOR_PRE_SAVE = 9001,
		NOTIFICATION_EDITOR_POST_SAVE = 9002,
	};
	
	StringName get_name() const;
	String get_description() const;
	void set_name(const String &p_name);
	void add_child(Node *p_child, bool p_force_readable_name = false, InternalMode p_internal = INTERNAL_MODE_DISABLED);
	void add_sibling(Node *p_sibling, bool p_force_readable_name = false);
	void remove_child(Node *p_child);
	int get_child_count(bool p_include_internal = true) const;
	Node *get_child(int p_index, bool p_include_internal = true) const;
	TypedArray<Node> get_children(bool p_include_internal = true) const;
	bool has_node(const NodePath &p_path) const;
	Node *get_node(const NodePath &p_path) const;
	Node *get_node_or_null(const NodePath &p_path) const;
	Node *find_child(const String &p_pattern, bool p_recursive = true, bool p_owned = true) const;
	TypedArray<Node> find_children(const String &p_pattern, const String &p_type = "", bool p_recursive = true, bool p_owned = true) const;
	bool has_node_and_resource(const NodePath &p_path) const;
	Node *get_node_and_resource(const NodePath &p_path, Ref<Resource> &r_res, Vector<StringName> &r_leftover_subpath, bool p_last_is_property = true) const;
	virtual void reparent(Node *p_parent, bool p_keep_global_transform = true);
	Node *get_parent() const;
	Node *find_parent(const String &p_pattern) const;
	Window *get_window() const;
	Window *get_last_exclusive_window() const;
	_FORCE_INLINE_ SceneTree *get_tree() const {