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

mesh = p_mesh;
	polygons_dirty = true;
}
int NavRegion::get_connections_count() const {
	if (!map) {
		return 0;
	}
	return connections.size();
}
Vector3 NavRegion::get_connection_pathway_start(int p_connection_id) const {
	ERR_FAIL_COND_V(!map, Vector3());
	ERR_FAIL_INDEX_V(p_connection_id, connections.size(), Vector3());
	return connections[p_connection_id].pathway_start;
}
Vector3 NavRegion::get_connection_pathway_end(int p_connection_id) const {
	ERR_FAIL_COND_V(!map, Vector3());
	ERR_FAIL_INDEX_V(p_connection_id, connections.size(), Vector3());
	return connections[p_connection_id].pathway_end;
}
bool NavRegion::sync() {
	bool something_changed = polygons_dirty ;
	update_polygons();
	return something_changed;
}
void NavRegion::update_polygons() {