### Godot version

v4.2.rc.custom_build [702227129]

### System information

Godot v4.2.rc (702227129) - Debian GNU/Linux trixie/sid trixie - X11 - Vulkan (Forward+) - dedicated NVIDIA GeForce GTX 1060 6GB (nvidia) - AMD Ryzen 5 1600 Six-Core Processor (12 Threads)

### Issue description

Found a consistent crash when calling `hide()` from `_notification()`.
It does not happen if the call is deferred.

### Steps to reproduce

The `hide_test.gd` script has a boolean `cause_crash`. If it is true, hovering the mouse over the label crashes without an error in the Godot Editor Console. If it's false it hides the label as expected.

### Minimal reproduction project

[hide_crash.zip](https://github.com/godotengine/godot/files/13452818/hide_crash.zip)

if (o) {
			CollisionObject2D *co = Object::cast_to<CollisionObject2D>(o);
			if (co && co->is_inside_tree()) {
				if (p_clean_all_frames && p_paused_only && co->can_process()) {
					continue;
				}
				shapes_to_mouse_exit.push_back(E.key);
			}
		}
		shapes_to_erase.push_back(E.key);
	}
	while (shapes_to_erase.size()) {
		physics_2d_shape_mouseover.erase(shapes_to_erase.front()->get());
		shapes_to_erase.pop_front();
	}
	while (to_mouse_exit.size()) {
		Object *o = ObjectDB::get_instance(to_mouse_exit.front()->get());
		CollisionObject2D *co = Object::cast_to<CollisionObject2D>(o);
		co->_mouse_exit();
		to_mouse_exit.pop_front();
	}
	while (shapes_to_mouse_exit.size()) {
		Pair<ObjectID, int> e = shapes_to_mouse_exit.front()->get();
		Object *o = ObjectDB::get_instance(e.first);
		CollisionObject2D *co = Object::cast_to<CollisionObject2D>(o);
		co->_mouse_shape_exit(e.second);
		shapes_to_mouse_exit.pop_front();
	}
}
void Viewport::_gui_grab_click_focus(Control *p_control) {