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

physics_object_capture = last_id;
							}
						}
					}
					if (is_mouse && new_collider != physics_object_over) {
						if (physics_object_over.is_valid()) {
							CollisionObject3D *previous_co = Object::cast_to<CollisionObject3D>(ObjectDB::get_instance(physics_object_over));
							if (previous_co) {
								previous_co->_mouse_exit();
							}
						}
						if (new_collider.is_valid()) {
							DEV_ASSERT(co);
							co->_mouse_enter();
						}
						physics_object_over = new_collider;
					}
					if (capture_object) {
						_collision_object_3d_input_event(capture_object, camera_3d, ev, result.position, result.normal, result.shape);
					} else if (new_collider.is_valid()) {
						_collision_object_3d_input_event(co, camera_3d, ev, result.position, result.normal, result.shape);
					}
				}
				last_pos = pos;
			}
		}
#endif 
	}
}
RID Viewport::get_viewport_rid() const {