### Godot version

4.2.dev f2acfb1ffc94d0e381064070108e7a773d86177d

### System information

Ubuntu 22.04 CI

### Issue description

https://github.com/qarmin/GodotBuilds/actions/runs/5790813978/job/15694543373#step:7:679

Command 
```
scons dev_build=yes CCFLAGS="-fpie" LINKFLAGS="-no-pie" module_basis_universal_enabled=no module_bmp_enabled=no module_camera_enabled=no module_csg_enabled=no module_cvtt_enabled=no module_dds_enabled=no module_denoise_enabled=no module_enet_enabled=no module_etcpak_enabled=no module_glslang_enabled=no module_gltf_enabled=no module_gridmap_enabled=no module_hdr_enabled=no module_jpg_enabled=no module_jsonrpc_enabled=no module_lightmapper_rd_enabled=no module_mbedtls_enabled=no module_meshoptimizer_enabled=no module_minimp3_enabled=no module_mobile_vr_enabled=no module_multiplayer_enabled=no module_noise_enabled=no module_ogg_enabled=no module_openxr_enabled=no module_raycast_enabled=no module_regex_enabled=no module_squish_enabled=no module_tga_enabled=no module_theora_enabled=no module_tinyexr_enabled=no module_upnp_enabled=no module_vhacd_enabled=no module_vorbis_enabled=no module_webp_enabled=no module_webrtc_enabled=no module_websocket_enabled=no module_webxr_enabled=no module_xatlas_unwrap_enabled=no target=editor -j2
```
produce such errors

```
In file included from modules/navigation/nav_mesh_generator_3d.cpp:33:
modules/navigation/nav_mesh_generator_3d.h:40:7: note: forward declaration of 'class NavigationMesh'
   40 | class NavigationMesh;
      |       ^~~~~~~~~~~~~~
modules/navigation/nav_mesh_generator_3d.cpp:704:42: error: invalid use of incomplete type 'class NavigationMesh'
  704 |                         p_navigation_mesh->add_polygon(nav_indices);
      |                                          ^~
In file included from modules/navigation/nav_mesh_generator_3d.cpp:33:
modules/navigation/nav_mesh_generator_3d.h:40:7: note: forward declaration of 'class NavigationMesh'
   40 | class NavigationMesh;
      |       ^~~~~~~~~~~~~~
In file included from ./core/io/resource_uid.h:34,
                 from ./core/io/resource.h:34,
                 from ./core/input/input_event.h:35,
                 from ./core/os/main_loop.h:34,
                 from ./scene/main/scene_tree.h:34,
                 from ./scene/main/node.h:37,
                 from ./scene/3d/node_3d.h:34,
                 from ./scene/3d/visual_instance_3d.h:34,
                 from ./scene/3d/mesh_instance_3d.h:35,
                 from modules/navigation/nav_mesh_generator_3d.cpp:37:
./core/object/ref_counted.h: In instantiation of 'void Ref<T>::ref(const Ref<T>&) [with T = NavigationMesh]':
./core/object/ref_counted.h:166:3:   required from 'Ref<T>::Ref(const Ref<T>&) [with T = NavigationMesh]'
modules/navigation/nav_mesh_generator_3d.cpp:118:42:   required from here
./core/object/ref_counted.h:69:36: error: invalid use of incomplete type 'class NavigationMesh'
   69 |                         reference->reference();
      |                         ~~~~~~~~~~~^~~~~~~~~
In file included from modules/navigation/nav_mesh_generator_3d.cpp:33:
modules/navigation/nav_mesh_generator_3d.h:40:7: note: forward declaration of 'class NavigationMesh'
   40 | class NavigationMesh;
      |       ^~~~~~~~~~~~~~
In file included from ./core/io/resource_uid.h:34,
                 from ./core/io/resource.h:34,
                 from ./core/input/input_event.h:35,
                 from ./core/os/main_loop.h:34,
                 from ./scene/main/scene_tree.h:34,
                 from ./scene/main/node.h:37,
                 from ./scene/3d/node_3d.h:34,
                 from ./scene/3d/visual_instance_3d.h:34,
                 from ./scene/3d/mesh_instance_3d.h:35,
                 from modules/navigation/nav_mesh_generator_3d.cpp:37:
./core/object/ref_counted.h: In instantiation of 'void Ref<T>::unref() [with T = NavigationMesh]':
./core/object/ref_counted.h:222:3:   required from 'Ref<T>::~Ref() [with T = NavigationMesh]'
modules/navigation/nav_mesh_generator_3d.cpp:118:42:   required from here
./core/object/ref_counted.h:209:45: error: invalid use of incomplete type 'class NavigationMesh'
  209 |                 if (reference && reference->unreference()) {
      |                                  ~~~~~~~~~~~^~~~~~~~~~~
In file included from modules/navigation/nav_mesh_generator_3d.cpp:33:
modules/navigation/nav_mesh_generator_3d.h:40:7: note: forward declaration of 'class NavigationMesh'
   40 | class NavigationMesh;
      |       ^~~~~~~~~~~~~~
scons: *** [modules/navigation/nav_mesh_generator_3d.linuxbsd.editor.dev.x86_64.o] Error 1
scons: building terminated because of errors.
```
this is 1 day old regression, probably caused by https://github.com/godotengine/godot/commit/7eb047a5edf5b87e519e149b11e2b00543b62e72

"\nSource geometry is suspiciously big for the current Cell Size and Cell Height in the NavMesh Resource bake settings."
				   "\nIf baking does not fail, the resulting NavigationMesh will create serious pathfinding performance issues."
				   "\nIt is advised to increase Cell Size and/or Cell Height in the NavMesh Resource bake settings or reduce the size / scale of the source geometry.");
	}
	bake_state = "Creating heightfield..."; 
	hf = rcAllocHeightfield();
	ERR_FAIL_COND(!hf);
	ERR_FAIL_COND(!rcCreateHeightfield(&ctx, *hf, cfg.width, cfg.height, cfg.bmin, cfg.bmax, cfg.cs, cfg.ch));
	bake_state = "Marking walkable triangles..."; 
	{
		Vector<unsigned char> tri_areas;
		tri_areas.resize(ntris);
		ERR_FAIL_COND(tri_areas.size() == 0);
		memset(tri_areas.ptrw(), 0, ntris * sizeof(unsigned char));
		rcMarkWalkableTriangles(&ctx, cfg.walkableSlopeAngle, verts, nverts, tris, ntris, tri_areas.ptrw());
		ERR_FAIL_COND(!rcRasterizeTriangles(&ctx, verts, nverts, tris, tri_areas.ptr(), ntris, *hf, cfg.walkableClimb));
	}
	if (p_navigation_mesh->get_filter_low_hanging_obstacles()) {
		rcFilterLowHangingWalkableObstacles(&ctx, cfg.walkableClimb, *hf);
	}
	if (p_navigation_mesh->get_filter_ledge_spans()) {
		rcFilterLedgeSpans(&ctx, cfg.walkableHeight, cfg.walkableClimb, *hf);
	}
	if (p_navigation_mesh->get_filter_walkable_low_height_spans()) {
		rcFilterWalkableLowHeightSpans(&ctx, cfg.walkableHeight, *hf);
	}
	bake_state = "Constructing compact heightfield..."; 
	chf = rcAllocCompactHeightfield();
	ERR_FAIL_COND(!chf);
	ERR_FAIL_COND(!rcBuildCompactHeightfield(&ctx, cfg.walkableHeight, cfg.walkableClimb, *hf, *chf));