### Godot version

4.0.stable

### System information

Windows 10

### Issue description

In my project, we are rendering a GUI to a QuadMesh as an in-game interactive display. We push mouse click events when the player clicks the display. This worked fine during 4.0 beta, but after moving to the stable release the buttons on TreeItems stopped working. I put together a MRP and went back through the versions and it seems the issue started in RC1.

### Steps to reproduce

When running the MRP, it has a standard GUI on the left hand side of the screen and a QuadMesh rendered GUI on the right hand side. If you click the + button on an item, it will add another item to the list. On the QuadMesh you will see that you can highlight and collapse items in the list, but the + button does not function. If you run the MRP on 4.0.beta17 everything will function as expected.

### Minimal reproduction project

[TreeUI_through_SubViewport.zip](https://github.com/godotengine/godot/files/10959159/TreeUI_through_SubViewport.zip)

ERR_MAIN_THREAD_GUARD;
	if (use_xr != p_use_xr) {
		use_xr = p_use_xr;
		RS::get_singleton()->viewport_set_use_xr(viewport, use_xr);
		if (!use_xr) {
			
			if (size_allocated) {
				RS::get_singleton()->viewport_set_size(viewport, size.width, size.height);
			} else {
				RS::get_singleton()->viewport_set_size(viewport, 0, 0);
			}
		}
	}
}
bool Viewport::is_using_xr() {