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

clear();
		ERR_FAIL_V(err);
	}
	err = _parse_connections(scene, scene, name_map, variant_map, node_map, nodepath_map);
	if (err) {
		clear();
		ERR_FAIL_V(err);
	}
	names.resize(name_map.size());
	for (const KeyValue<StringName, int> &E : name_map) {
		names.write[E.value] = E.key;
	}
	variants.resize(variant_map.size());
	for (const KeyValue<Variant, int> &E : variant_map) {
		int idx = E.value;
		variants.write[idx] = E.key;
	}
	node_paths.resize(nodepath_map.size());
	for (const KeyValue<Node *, int> &E : nodepath_map) {
		node_paths.write[E.value] = scene->get_path_to(E.key);
	}
	if (Engine::get_singleton()->is_editor_hint()) {
		
		for (const KeyValue<Node *, int> &E : node_map) {
			node_path_cache[scene->get_path_to(E.key)] = E.value;
		}
	}
	return OK;
}
void SceneState::set_path(const String &p_path) {