### Godot version

v4.0.stable.official [92bee43ad]

### System information

Windows10,64,OpenGL API 3.3.0 NVIDIA 425.25 - Compatibility - Using Device: NVIDIA Corporation - GeForce MX250

### Issue description

When I change the tileset texture area size, godot crashes with the following error

The tileset contains a 107*35 sprite sheet

```
ERROR: UndoRedo history mismatch: expected 0, got 2.
   at: (editor/editor_undo_redo_manager.cpp:108)
```

### Steps to reproduce

1. create a tilemap node
2. create a tileset
3. click the tileset
4. drag the spritesheet(107*35) into the tileset
5. click yes with "auto create tiles in non-tra... "pop
6. change the tileset texture region size
7. program freezes
8.
 ```
ERROR: UndoRedo history mismatch: expected 0, got 2.
   at: (editor/editor_undo_redo_manager.cpp:108)
```

### Minimal reproduction project

[test1.zip](https://github.com/godotengine/godot/files/10918599/test1.zip)

return;
		}
		Ref<InputEventMouseButton> mb = me;
		if (mb.is_valid() && mb->get_button_index() == MouseButton::LEFT && mb->is_pressed() && dock_popup_selected_idx != nrect) {
			Control *dock = dock_slot[dock_popup_selected_idx]->get_current_tab_control();
			if (dock) {
				dock_slot[dock_popup_selected_idx]->remove_child(dock);
			}
			if (dock_slot[dock_popup_selected_idx]->get_tab_count() == 0) {
				dock_slot[dock_popup_selected_idx]->hide();
			} else {
				dock_slot[dock_popup_selected_idx]->set_current_tab(0);
			}
			dock_slot[nrect]->add_child(dock);
			dock_popup_selected_idx = nrect;
			dock_slot[nrect]->set_current_tab(dock_slot[nrect]->get_tab_count() - 1);
			dock_slot[nrect]->set_tab_title(dock_slot[nrect]->get_tab_count() - 1, TTRGET(dock->get_name()));
			dock_slot[nrect]->show();
			dock_select->queue_redraw();
			_update_dock_containers();
			_edit_current();
			_save_editor_layout();
		}
	}
}
void EditorNode::_dock_popup_exit() {
	dock_select_rect_over_idx = -1;
	dock_select->queue_redraw();
}
void EditorNode::_dock_pre_popup(int p_which) {