### Godot version

v4.0.3.stable.official [5222a99f5]

### System information

Mac

### Issue description

The following code will not print any vertices, nor polygons. 
The `NavigationMesh` resource will not be saved correctly.

Even though we specify `bake_navigation_mesh(false)` (on the main thread)

```gdscript
func _ready() -> void:
	var navreg = $NavigationRegion3D
	navreg.bake_navigation_mesh(false)
	
	print(navreg.navmesh.get_vertices())
	print(navreg.navmesh.get_polygon_count())

	var to_save = preload("res://testresource.gd").new(navreg.navmesh)
	ResourceSaver.save(
		to_save,
		"output.tres",
		ResourceSaver.SaverFlags.FLAG_BUNDLE_RESOURCES
	)
```

### Steps to reproduce

1. Download minimal repo below
2. Run the repo
3. Check the console
4. Check `output.tres`

<img width="316" alt="Screenshot 2023-06-03 at 19 05 22" src="https://github.com/godotengine/godot/assets/100964/83ea661d-1c5a-4044-b9cc-2a5434a89280">

<img width="1028" alt="Screenshot 2023-06-03 at 19 05 34" src="https://github.com/godotengine/godot/assets/100964/cb099d0c-f626-48a4-b4f4-9a57b7988df1">


### Minimal reproduction project

[test-navmesh.zip](https://github.com/godotengine/godot/files/11642578/test-navmesh.zip)

Vector3 left_end_pos = connection_pathway_end + (end_right_dir * half_edge_connection_margin);
		Vector3 right_end_pos = connection_pathway_end + (end_left_dir * half_edge_connection_margin);
		vertex_array.push_back(right_end_pos);
		vertex_array.push_back(left_start_pos);
		vertex_array.push_back(right_start_pos);
		vertex_array.push_back(left_end_pos);
		vertex_array.push_back(right_end_pos);
		vertex_array.push_back(right_start_pos);
	}
	if (vertex_array.size() == 0) {
		return;
	}
	Ref<StandardMaterial3D> edge_connections_material = NavigationServer3D::get_singleton()->get_debug_navigation_edge_connections_material();
	Array mesh_array;
	mesh_array.resize(Mesh::ARRAY_MAX);
	mesh_array[Mesh::ARRAY_VERTEX] = vertex_array;
	debug_edge_connections_mesh->add_surface_from_arrays(Mesh::PRIMITIVE_TRIANGLES, mesh_array);
	debug_edge_connections_mesh->surface_set_material(0, edge_connections_material);
	RS::get_singleton()->instance_set_base(debug_edge_connections_instance, debug_edge_connections_mesh->get_rid());
	RS::get_singleton()->instance_set_visible(debug_edge_connections_instance, is_visible_in_tree());
	if (is_inside_tree()) {
		RS::get_singleton()->instance_set_scenario(debug_edge_connections_instance, get_world_3d()->get_scenario());
	}
	bool enable_edge_connections = NavigationServer3D::get_singleton()->get_debug_navigation_enable_edge_connections();
	if (!enable_edge_connections) {
		RS::get_singleton()->instance_set_visible(debug_edge_connections_instance, false);
	}
}
#endif