### Godot version

4.0.2.stable.official

### System information

Windows 10, NVIDIA GeForce RTX 2080 SUPER, Driver 516.94, Vulkan backend

### Issue description

When referencing a built-in matrix (MODEL_MATRIX, VIEW_MATRIX...) within the light() function of a spatial shader, these errors are thrown per renderer:

Forward+:
```
-   servers/rendering/renderer_rd/forward_clustered/scene_shader_forward_clustered.cpp:171 - Condition "!shader_singleton->shader.version_is_valid(version)" is true.
```
Mobile:
```
-   servers/rendering/renderer_rd/forward_mobile/scene_shader_forward_mobile.cpp:182 - Condition "!shader_singleton->shader.version_is_valid(version)" is true.
```
Compatibility (MODEL_MATRIX is referenced):
```
-  drivers/gles3/shader_gles3.cpp:242 - SceneShaderGLES3: Fragment shader compilation failed:
-   0(521) : error C1503: undefined variable "model_matrix"
-   drivers/gles3/shader_gles3.cpp:342 - Method/function failed.
```

The shader displays a fallback instead of what's written. This can be avoided by defining a variable that is identical to the matrix and referencing that instead:

```
shader_type spatial;

varying mat4 mdlMtx;

void vertex() {
	mdlMtx = MODEL_MATRIX;
}

void light() {
	mdlMtx; // works
//	MODEL_MATRIX; // doesn't work
}
```


### Steps to reproduce

In a spatial shader, reference any built-in matrix within the light function:

```
shader_type spatial;

void light() {
	DIFFUSE_LIGHT += ATTENUATION; // lighting that should be displayed
	MODEL_MATRIX; // breaks the shader, displays a fallback
}
```

### Minimal reproduction project

[issue_light_matrices.zip](https://github.com/godotengine/godot/files/11356572/issue_light_matrices.zip)

actions.write_flag_pointers["PROJECTION_MATRIX"] = &writes_modelview_or_projection;
	actions.write_flag_pointers["VERTEX"] = &uses_vertex;
	actions.uniforms = &uniforms;
	SceneShaderForwardMobile *shader_singleton = (SceneShaderForwardMobile *)SceneShaderForwardMobile::singleton;
	Error err = shader_singleton->compiler.compile(RS::SHADER_SPATIAL, code, &actions, path, gen_code);
	ERR_FAIL_COND_MSG(err != OK, "Shader compilation failed.");
	if (version.is_null()) {
		version = shader_singleton->shader.version_create();
	}
	depth_draw = DepthDraw(depth_drawi);
	depth_test = DepthTest(depth_testi);
	uses_vertex_time = gen_code.uses_vertex_time;
	uses_fragment_time = gen_code.uses_fragment_time;
	uses_screen_texture_mipmaps = gen_code.uses_screen_texture_mipmaps;
	uses_screen_texture = gen_code.uses_screen_texture;
	uses_depth_texture = gen_code.uses_depth_texture;
	uses_normal_texture = gen_code.uses_normal_roughness_texture;
#ifdef DEBUG_ENABLED
	if (uses_sss) {
		WARN_PRINT_ONCE_ED("Sub-surface scattering is only available when using the Forward+ rendering backend.");
	}
	if (uses_transmittance) {
		WARN_PRINT_ONCE_ED("Transmittance is only available when using the Forward+ rendering backend.");
	}
#endif
#if 0
	print_line("**compiling shader:");
	print_line("**defines:\n");
	for (int i = 0; i < gen_code.defines.size(); i++) {
		print_line(gen_code.defines[i]);