### Godot version

4.1.dev 2e273f0e35800f2bcc7c05db54100caa97928f69

### System information

macOS 13.4

### Issue description

Removing a SpinBox from the node tree using `remove_child` during the line edit text submit signal will crash the engine.

```
handle_crash: Program crashed with signal 11
Engine version: Godot Engine v4.1.dev.custom_build (2e273f0e35800f2bcc7c05db54100caa97928f69)
Dumping the backtrace. Please include this when reporting the bug to the project developer.
[1] 1   libsystem_platform.dylib            0x0000000183b5aa24 _sigtramp + 56
[2] Viewport::gui_get_focus_owner() (in godot.macos.editor.arm64) + 32
[3] SpinBox::_line_edit_focus_exit() (in godot.macos.editor.arm64) + 28
[4] CallQueue::_call_function(Callable const&, Variant const*, int, bool) (in godot.macos.editor.arm64) + 336
[5] CallQueue::flush() (in godot.macos.editor.arm64) + 908
[6] SceneTree::physics_process(double) (in godot.macos.editor.arm64) + 244
[7] Main::iteration() (in godot.macos.editor.arm64) + 528
```

### Steps to reproduce

Open the minimal reproduction project, click on the SpinBox, press enter, and the engine crashes.

### Minimal reproduction project

[SpinBoxTextSubmitCrash.zip](https://github.com/godotengine/godot/files/11631081/SpinBoxTextSubmitCrash.zip)

if (gui.subwindow_drag != SUB_WINDOW_DRAG_DISABLED) {
		ERR_FAIL_COND_V(gui.subwindow_focused == nullptr, false);
		Ref<InputEventMouseButton> mb = p_event;
		if (mb.is_valid() && !mb->is_pressed() && mb->get_button_index() == MouseButton::LEFT) {
			if (gui.subwindow_drag == SUB_WINDOW_DRAG_CLOSE) {
				if (gui.subwindow_drag_close_rect.has_point(mb->get_position())) {
					
					gui.subwindow_focused->_event_callback(DisplayServer::WINDOW_EVENT_CLOSE_REQUEST);
				}
			}
			gui.subwindow_drag = SUB_WINDOW_DRAG_DISABLED;
			if (gui.subwindow_focused != nullptr) { 
				_sub_window_update(gui.subwindow_focused);
			}
		}
		Ref<InputEventMouseMotion> mm = p_event;
		if (mm.is_valid()) {
			if (gui.subwindow_drag == SUB_WINDOW_DRAG_MOVE) {
				Vector2 diff = mm->get_position() - gui.subwindow_drag_from;
				Rect2i new_rect(gui.subwindow_drag_pos + diff, gui.subwindow_focused->get_size());
				if (gui.subwindow_focused->is_clamped_to_embedder()) {
					new_rect = gui.subwindow_focused->fit_rect_in_parent(new_rect, get_visible_rect());
				}
				gui.subwindow_focused->_rect_changed_callback(new_rect);
				if (DisplayServer::get_singleton()->has_feature(DisplayServer::FEATURE_CURSOR_SHAPE)) {
					DisplayServer::get_singleton()->cursor_set_shape(DisplayServer::CURSOR_MOVE);
				}
			}
			if (gui.subwindow_drag == SUB_WINDOW_DRAG_CLOSE) {
				gui.subwindow_drag_close_inside = gui.subwindow_drag_close_rect.has_point(mm->get_position());