### Godot version

4.1.beta1

### System information

Godot v4.1.beta1 - Windows 10.0.22621 - Vulkan (Forward+) - dedicated NVIDIA GeForce RTX 3060 Ti (NVIDIA; 31.0.15.2802) - 11th Gen Intel(R) Core(TM) i5-11400F @ 2.60GHz (12 Threads)

### Issue description

The agent finds the correct path between a and b.

Then the scene is rotated 180 degress.

Now the agent is taking a longer path than it needs to.

https://github.com/godotengine/godot/assets/6430599/3fa04c4f-49a0-468d-9d4c-4a12dee3cb5b



### Steps to reproduce

Download project. Press "a" and "d" to rotate the scene around the z axis.

### Minimal reproduction project

[movenav.zip](https://github.com/godotengine/godot/files/11725682/movenav.zip)

if (!polygons_dirty) {
		return;
	}
	polygons.clear();
	polygons_dirty = false;
	if (map == nullptr) {
		return;
	}
	if (mesh.is_null()) {
		return;
	}
	if (!Math::is_equal_approx(double(map->get_cell_size()), double(mesh->get_cell_size()))) {
		ERR_PRINT_ONCE("Navigation map synchronization error. Attempted to update a navigation region with a navigation mesh that uses a different `cell_size` than the `cell_size` set on the navigation map.");
	}
	Vector<Vector3> vertices = mesh->get_vertices();
	int len = vertices.size();
	if (len == 0) {
		return;
	}
	const Vector3 *vertices_r = vertices.ptr();
	polygons.resize(mesh->get_polygon_count());
	
	for (size_t i(0); i < polygons.size(); i++) {
		gd::Polygon &p = polygons[i];
		p.owner = this;
		Vector<int> mesh_poly = mesh->get_polygon(i);
		const int *indices = mesh_poly.ptr();
		bool valid(true);