### Godot version

v4.1.stable.mono.official [970459615]

### System information

Godot v4.1.stable.mono - Windows 10.0.19045 - Vulkan (Forward+) - dedicated NVIDIA GeForce GTX 1050 Ti (NVIDIA; 31.0.15.3179) - AMD Ryzen 3 3200G with Radeon Vega Graphics (4 Threads)

### Issue description

I have a scene with a large amount of InstanceMesh3D, StaticBody3D which are in a Map node. This scene does not cause any lags for me, but as soon as I expand the Map node, my scene starts to lag and it is impossible to work with the project at all. Before that I moved my project from 4.0.2.stable to 4.1.stable. The previous version did not cause such problems.

### Steps to reproduce

Create a scene of over +500 MeshInstance3D with any shape that is in a Node3D node. Try to open and close Node3D and you will see the performance drop.

### Minimal reproduction project

N/A
const Size2 control_size = get_size();
	const Ref<StyleBox> background = theme_cache.panel_style;
	
	const real_t width = control_size.x - background->get_margin(SIDE_LEFT) - background->get_margin(SIDE_RIGHT);
	const real_t height = control_size.y - background->get_margin(SIDE_TOP) - background->get_margin(SIDE_BOTTOM);
	const Rect2 content_rect = Rect2(background->get_offset(), Size2(width, height));
	
	const real_t top = theme_cache.scrollbar_margin_top < 0 ? content_rect.get_position().y : theme_cache.scrollbar_margin_top;
	const real_t right = theme_cache.scrollbar_margin_right < 0 ? content_rect.get_end().x : (control_size.x - theme_cache.scrollbar_margin_right);
	const real_t bottom = theme_cache.scrollbar_margin_bottom < 0 ? content_rect.get_end().y : (control_size.y - theme_cache.scrollbar_margin_bottom);
	const real_t left = theme_cache.scrollbar_margin_left < 0 ? content_rect.get_position().x : theme_cache.scrollbar_margin_left;
	return Rect2(left, top, right - left, bottom - top);
}
Rect2 Tree::_get_content_rect() const {
	const Size2 control_size = get_size();
	const Ref<StyleBox> background = theme_cache.panel_style;
	
	const real_t width = control_size.x - background->get_margin(SIDE_LEFT) - background->get_margin(SIDE_RIGHT);
	const real_t height = control_size.y - background->get_margin(SIDE_TOP) - background->get_margin(SIDE_BOTTOM);
	const Rect2 content_rect = Rect2(background->get_offset(), Size2(width, height));
	
	const real_t v_size = v_scroll->is_visible() ? (v_scroll->get_combined_minimum_size().x + theme_cache.scrollbar_h_separation) : 0;
	const real_t h_size = h_scroll->is_visible() ? (h_scroll->get_combined_minimum_size().y + theme_cache.scrollbar_v_separation) : 0;
	const Point2 scroll_begin = _get_scrollbar_layout_rect().get_end() - Vector2(v_size, h_size);
	const Size2 offset = (content_rect.get_end() - scroll_begin).max(Vector2(0, 0));
	return content_rect.grow_individual(0, 0, -offset.x, -offset.y);
}
void Tree::gui_input(const Ref<InputEvent> &p_event) {