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

ERR_FAIL_INDEX_V(p_idx, nodes.size(), Ref<PackedScene>());
	if (nodes[p_idx].instance >= 0) {
		if (nodes[p_idx].instance & FLAG_INSTANCE_IS_PLACEHOLDER) {
			return Ref<PackedScene>();
		} else {
			return variants[nodes[p_idx].instance & FLAG_MASK];
		}
	} else if (nodes[p_idx].parent < 0 || nodes[p_idx].parent == NO_PARENT_SAVED) {
		if (base_scene_idx >= 0) {
			return variants[base_scene_idx];
		}
	}
	return Ref<PackedScene>();
}
String SceneState::get_node_instance_placeholder(int p_idx) const {
	ERR_FAIL_INDEX_V(p_idx, nodes.size(), String());
	if (nodes[p_idx].instance >= 0 && (nodes[p_idx].instance & FLAG_INSTANCE_IS_PLACEHOLDER)) {
		return variants[nodes[p_idx].instance & FLAG_MASK];
	}
	return String();
}
Vector<StringName> SceneState::get_node_groups(int p_idx) const {
	ERR_FAIL_INDEX_V(p_idx, nodes.size(), Vector<StringName>());
	Vector<StringName> groups;
	for (int i = 0; i < nodes[p_idx].groups.size(); i++) {
		groups.push_back(names[nodes[p_idx].groups[i]]);
	}
	return groups;
}
NodePath SceneState::get_node_path(int p_idx, bool p_for_parent) const {