### 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)

tool_settings->add_child(tool_advanced_menu_button);
	_update_toolbar();
	
	Control *middle_space = memnew(Control);
	middle_space->set_h_size_flags(SIZE_EXPAND_FILL);
	tool_settings->add_child(middle_space);
	tool_tile_id_label = memnew(Label);
	tool_tile_id_label->set_mouse_filter(Control::MOUSE_FILTER_STOP);
	tool_settings->add_child(tool_tile_id_label);
	_update_tile_id_label();
	
	VBoxContainer *right_panel = memnew(VBoxContainer);
	right_panel->set_h_size_flags(SIZE_EXPAND_FILL);
	right_panel->set_v_size_flags(SIZE_EXPAND_FILL);
	right_vbox_container->add_child(right_panel);
	
	tile_atlas_view = memnew(TileAtlasView);
	tile_atlas_view->set_h_size_flags(SIZE_EXPAND_FILL);
	tile_atlas_view->set_v_size_flags(SIZE_EXPAND_FILL);
	tile_atlas_view->set_custom_minimum_size(Size2(200, 0) * EDSCALE);
	tile_atlas_view->connect("transform_changed", callable_mp(TilesEditorPlugin::get_singleton(), &TilesEditorPlugin::set_atlas_view_transform));
	tile_atlas_view->connect("transform_changed", callable_mp(this, &TileSetAtlasSourceEditor::_tile_atlas_view_transform_changed).unbind(2));
	right_panel->add_child(tile_atlas_view);
	base_tile_popup_menu = memnew(PopupMenu);
	base_tile_popup_menu->add_shortcut(ED_SHORTCUT("tiles_editor/delete", TTR("Delete"), Key::KEY_DELETE), TILE_DELETE);
	base_tile_popup_menu->add_item(TTR("Create an Alternative Tile"), TILE_CREATE_ALTERNATIVE);
	base_tile_popup_menu->connect("id_pressed", callable_mp(this, &TileSetAtlasSourceEditor::_menu_option));
	tile_atlas_view->add_child(base_tile_popup_menu);
	empty_base_tile_popup_menu = memnew(PopupMenu);
	empty_base_tile_popup_menu->add_item(TTR("Create a Tile"), TILE_CREATE);