### Godot version

4.0 d93b66a

### System information

Windows 10 x64

### Issue description

I have a 2D scene with some 3D nodes. The root is node 2D, most nodes are 2D, I have 2D node selected. When I switch scene tab and back, the editor switches to 3D view, even though the 2D node is still selected.

I managed to strip the scene to bare minimum. You need a Node3D with Camera3D and DirectionalLight3D children.

https://user-images.githubusercontent.com/2223172/213327465-ba07760e-6dab-43c0-96e8-5109fcc0a576.mp4


### Steps to reproduce

1. Make 2D scene
2. Add some 3D
3. This bug has a chance to happen
4. Check the repro for setup that reproduces the issue

### Minimal reproduction project

[3DBug.tscn.txt](https://github.com/godotengine/godot/files/10452297/3DBug.tscn.txt)

case SETTINGS_EDITOR_CONFIG_FOLDER: {
			OS::get_singleton()->shell_open(String("file://") + EditorPaths::get_singleton()->get_config_dir());
		} break;
		case SETTINGS_MANAGE_EXPORT_TEMPLATES: {
			export_template_manager->popup_manager();
		} break;
		case SETTINGS_MANAGE_FBX_IMPORTER: {
#if !defined(ANDROID_ENABLED) && !defined(WEB_ENABLED)
			fbx_importer_manager->show_dialog();
#endif
		} break;
		case SETTINGS_INSTALL_ANDROID_BUILD_TEMPLATE: {
			custom_build_manage_templates->hide();
			file_android_build_source->popup_centered_ratio();
		} break;
		case SETTINGS_MANAGE_FEATURE_PROFILES: {
			feature_profile_manager->popup_centered_clamped(Size2(900, 800) * EDSCALE, 0.8);
		} break;
		case SETTINGS_TOGGLE_FULLSCREEN: {
			DisplayServer::get_singleton()->window_set_mode(DisplayServer::get_singleton()->window_get_mode() == DisplayServer::WINDOW_MODE_FULLSCREEN ? DisplayServer::WINDOW_MODE_WINDOWED : DisplayServer::WINDOW_MODE_FULLSCREEN);
		} break;
		case EDITOR_SCREENSHOT: {
			screenshot_timer->start();
		} break;
		case SETTINGS_PICK_MAIN_SCENE: {
			file->set_file_mode(EditorFileDialog::FILE_MODE_OPEN_FILE);
			List<String> extensions;
			ResourceLoader::get_recognized_extensions_for_type("PackedScene", &extensions);
			file->clear_filters();
			for (int i = 0; i < extensions.size(); i++) {