### Godot version

v4.0.beta.custom_build [0a9e6e478]

### System information

Ubuntu, Nvidia, Vulkan

### Issue description

When a Camera2D is freed - either explicitly or by being a child of a scene that is being switched away from via a method like `get_tree().change_scene_to_file()` - then this camera somehow stays active instead of Godot properly switching to no-camera-mode.

`get_viewport().get_camera_2d()` then returns all sorts of funny things from `<Freed Object>`  (it's supposed to return `null`) to arbitrary nodes of the current scene (not cameras).

This can lead to crashes.

### Steps to reproduce

checkout the MRP.

note that the "Go to scene 2" button switches places after pressing it.
that is because a camera is still active that does not exist in the current tree.

restart it a couple of times and spam the "Go to scene 2" button.
notice the garbage output.

### Minimal reproduction project

[godot_4_camera_bug.zip](https://github.com/godotengine/godot/files/10560455/godot_4_camera_bug.zip)
first = false;
	}
	Point2 screen_offset = (anchor_mode == ANCHOR_MODE_DRAG_CENTER ? (screen_size * 0.5 * zoom_scale) : Point2());
	if (!ignore_rotation) {
		if (rotation_smoothing_enabled && !Engine::get_singleton()->is_editor_hint()) {
			real_t step = rotation_smoothing_speed * (process_callback == CAMERA2D_PROCESS_PHYSICS ? get_physics_process_delta_time() : get_process_delta_time());
			camera_angle = Math::lerp_angle(camera_angle, get_global_rotation(), step);
		} else {
			camera_angle = get_global_rotation();
		}
		screen_offset = screen_offset.rotated(camera_angle);
	}
	Rect2 screen_rect(-screen_offset + ret_camera_pos, screen_size * zoom_scale);
	if (!follow_smoothing_enabled || !limit_smoothing_enabled) {
		if (screen_rect.position.x < limit[SIDE_LEFT]) {
			screen_rect.position.x = limit[SIDE_LEFT];
		}
		if (screen_rect.position.x + screen_rect.size.x > limit[SIDE_RIGHT]) {
			screen_rect.position.x = limit[SIDE_RIGHT] - screen_rect.size.x;
		}
		if (screen_rect.position.y + screen_rect.size.y > limit[SIDE_BOTTOM]) {
			screen_rect.position.y = limit[SIDE_BOTTOM] - screen_rect.size.y;
		}
		if (screen_rect.position.y < limit[SIDE_TOP]) {
			screen_rect.position.y = limit[SIDE_TOP];
		}
	}
	if (offset != Vector2()) {
		screen_rect.position += offset;
	}