### Godot version

4.0-rc6

### System information

Fedora 37, Mesa Intel ADL GT2

### Issue description

Code that works as expected at runtime fails with Nil references to (assigned) exported vars in the editor:

![tool_global_position_error](https://user-images.githubusercontent.com/364501/222031460-ffb1ecbd-5175-4a42-8470-25285ba5f821.png)


### Steps to reproduce

Try to access the `global_position` of a `Node3D` that's assigned to an exported var.

See that it works at runtime.

See that it errors in the editor with:

> Invalid get index 'global_position' (on base: 'Nil').

### Minimal reproduction project

[tool_test.zip](https://github.com/godotengine/godot/files/10856640/tool_test.zip)

}
				}
			}
			if ((expansion_rows != prev_expansion_rows) && expanded) {
				update_minimum_size();
			}
			if ((expansion_rows == 0) && (layer_index == layer_count)) {
				
				break;
			}
			Ref<Texture2D> arrow = get_theme_icon(SNAME("arrow"), SNAME("Tree"));
			ERR_FAIL_COND(arrow.is_null());
			Color arrow_color = get_theme_color(SNAME("highlight_color"), SNAME("Editor"));
			arrow_color.a = expand_hovered ? 1.0 : 0.6;
			arrow_pos.x += 2.0;
			arrow_pos.y -= arrow->get_height();
			Rect2 arrow_draw_rect(arrow_pos, arrow->get_size());
			expand_rect = arrow_draw_rect;
			if (expanded) {
				arrow_draw_rect.size.y *= -1.0; 
			}
			RID ci = get_canvas_item();
			arrow->draw_rect(ci, arrow_draw_rect, false, arrow_color);
		} break;
		case NOTIFICATION_MOUSE_EXIT: {
			_on_hover_exit();
		} break;
	}
}
void EditorPropertyLayersGrid::set_flag(uint32_t p_flag) {