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

scene_tabs->connect("tab_close_pressed", callable_mp(this, &EditorNode::_scene_tab_closed).bind(SCENE_TAB_CLOSE));
	scene_tabs->connect("tab_hovered", callable_mp(this, &EditorNode::_scene_tab_hovered));
	scene_tabs->connect("mouse_exited", callable_mp(this, &EditorNode::_scene_tab_exit));
	scene_tabs->connect("gui_input", callable_mp(this, &EditorNode::_scene_tab_input));
	scene_tabs->connect("active_tab_rearranged", callable_mp(this, &EditorNode::_reposition_active_tab));
	scene_tabs->connect("resized", callable_mp(this, &EditorNode::_update_scene_tabs));
	scene_tabs->set_h_size_flags(Control::SIZE_EXPAND_FILL);
	tabbar_container->add_child(scene_tabs);
	scene_tabs_context_menu = memnew(PopupMenu);
	tabbar_container->add_child(scene_tabs_context_menu);
	scene_tabs_context_menu->connect("id_pressed", callable_mp(this, &EditorNode::_menu_option));
	scene_tab_add = memnew(Button);
	scene_tab_add->set_flat(true);
	scene_tab_add->set_tooltip_text(TTR("Add a new scene."));
	scene_tab_add->set_icon(gui_base->get_theme_icon(SNAME("Add"), SNAME("EditorIcons")));
	scene_tab_add->add_theme_color_override("icon_normal_color", Color(0.6f, 0.6f, 0.6f, 0.8f));
	scene_tabs->add_child(scene_tab_add);
	scene_tab_add->connect("pressed", callable_mp(this, &EditorNode::_menu_option).bind(FILE_NEW_SCENE));
	scene_tab_add_ph = memnew(Control);
	scene_tab_add_ph->set_mouse_filter(Control::MOUSE_FILTER_IGNORE);
	scene_tab_add_ph->set_custom_minimum_size(scene_tab_add->get_minimum_size());
	tabbar_container->add_child(scene_tab_add_ph);
	distraction_free = memnew(Button);
	distraction_free->set_flat(true);
	ED_SHORTCUT_AND_COMMAND("editor/distraction_free_mode", TTR("Distraction Free Mode"), KeyModifierMask::CTRL | KeyModifierMask::SHIFT | Key::F11);
	ED_SHORTCUT_OVERRIDE("editor/distraction_free_mode", "macos", KeyModifierMask::META | KeyModifierMask::CTRL | Key::D);
	distraction_free->set_shortcut(ED_GET_SHORTCUT("editor/distraction_free_mode"));
	distraction_free->set_tooltip_text(TTR("Toggle distraction-free mode."));
	distraction_free->connect("pressed", callable_mp(this, &EditorNode::_toggle_distraction_free_mode));
	distraction_free->set_icon(gui_base->get_theme_icon(SNAME("DistractionFree"), SNAME("EditorIcons")));