### Godot version

f73cb4c13d1bc19b044fbef735522e3b0249e8ab

### System information

Windows 10, Vulkan

### Issue description

A CSGPolygon3D node with 'use_collision' on, in Path mode, with a path node assigned, throws the error "Node3D::get_global_transform: Condition "!is_inside_tree()" is true. Returning: Transform3D()" when running (and in some cases when switching scenes).

![image](https://user-images.githubusercontent.com/115422160/211907313-20742234-4a1f-4d94-b573-544b8e1d07ca.png)

~~In this same MRP you can also see a different error, when switching between scenes in the editor, that I've mentioned in https://github.com/godotengine/godot/issues/58869, I can open a separate issue if needed:~~
I've opened a separate issue for this in https://github.com/godotengine/godot/issues/71750.
![image](https://user-images.githubusercontent.com/115422160/211907528-1df7230e-6270-4669-bf44-2ef449eebf1d.png)



### Steps to reproduce

Run the MRP. It's a simple Node3D scene with a CSGPolygon3D and Path3D as children.

### Minimal reproduction project

[transform bug.zip](https://github.com/godotengine/godot/files/10395682/transform.bug.zip)

if (have_tangents) {
			array[Mesh::ARRAY_TANGENT] = surfaces[i].tans;
		}
		int idx = root_mesh->get_surface_count();
		root_mesh->add_surface_from_arrays(Mesh::PRIMITIVE_TRIANGLES, array);
		root_mesh->surface_set_material(idx, surfaces[i].material);
	}
	set_base(root_mesh->get_rid());
	_update_collision_faces();
}
void CSGShape3D::_update_collision_faces() {
	if (use_collision && is_root_shape() && root_collision_shape.is_valid()) {
		CSGBrush *n = _get_brush();
		ERR_FAIL_COND_MSG(!n, "Cannot get CSGBrush.");
		Vector<Vector3> physics_faces;
		physics_faces.resize(n->faces.size() * 3);
		Vector3 *physicsw = physics_faces.ptrw();
		for (int i = 0; i < n->faces.size(); i++) {
			int order[3] = { 0, 1, 2 };
			if (n->faces[i].invert) {
				SWAP(order[1], order[2]);
			}
			physicsw[i * 3 + 0] = n->faces[i].vertices[order[0]];
			physicsw[i * 3 + 1] = n->faces[i].vertices[order[1]];
			physicsw[i * 3 + 2] = n->faces[i].vertices[order[2]];
		}
		root_collision_shape->set_faces(physics_faces);
	}
}
AABB CSGShape3D::get_aabb() const {