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

play_custom_scene_button->set_focus_mode(Control::FOCUS_NONE);
	play_custom_scene_button->connect("pressed", callable_mp(this, &EditorNode::_menu_option).bind(RUN_PLAY_CUSTOM_SCENE));
	play_custom_scene_button->set_tooltip_text(TTR("Run a specific scene."));
	_reset_play_buttons();
	ED_SHORTCUT_AND_COMMAND("editor/run_specific_scene", TTR("Run Specific Scene"), KeyModifierMask::CTRL | KeyModifierMask::SHIFT | Key::F5);
	ED_SHORTCUT_OVERRIDE("editor/run_specific_scene", "macos", KeyModifierMask::META | KeyModifierMask::SHIFT | Key::R);
	play_custom_scene_button->set_shortcut(ED_GET_SHORTCUT("editor/run_specific_scene"));
	write_movie_panel = memnew(PanelContainer);
	write_movie_panel->add_theme_style_override("panel", gui_base->get_theme_stylebox(SNAME("MovieWriterButtonNormal"), SNAME("EditorStyles")));
	launch_pad_hb->add_child(write_movie_panel);
	write_movie_button = memnew(Button);
	write_movie_button->set_flat(true);
	write_movie_button->set_toggle_mode(true);
	write_movie_panel->add_child(write_movie_button);
	write_movie_button->set_pressed(false);
	write_movie_button->set_icon(gui_base->get_theme_icon(SNAME("MainMovieWrite"), SNAME("EditorIcons")));
	write_movie_button->set_focus_mode(Control::FOCUS_NONE);
	write_movie_button->connect("toggled", callable_mp(this, &EditorNode::_write_movie_toggled));
	write_movie_button->set_tooltip_text(TTR("Enable Movie Maker mode.\nThe project will run at stable FPS and the visual and audio output will be recorded to a video file."));
	
	write_movie_button->add_theme_color_override("icon_normal_color", Color(1, 1, 1, 0.7));
	write_movie_button->add_theme_color_override("icon_pressed_color", Color(0, 0, 0, 0.84));
	write_movie_button->add_theme_color_override("icon_hover_color", Color(1, 1, 1, 0.9));
	HBoxContainer *right_menu_hb = memnew(HBoxContainer);
	menu_hb->add_child(right_menu_hb);
	renderer = memnew(OptionButton);
	renderer->set_visible(true);
	renderer->set_flat(true);
	renderer->set_fit_to_longest_item(false);
	renderer->set_focus_mode(Control::FOCUS_NONE);