### Godot version

v4.1.beta.custom_build [522a2ea3f]

### System information

Windows 10, Vulkan, GTX 960 536.23

### Issue description

When the grid is disabled in a scene and subsequently closed, it will not be displayed again and will remain invisible unless you refresh it from the 'view' option. This doesn't happen with the origin, but sometimes its colors may appear faded if you try to activate the grid again.

### Steps to reproduce


https://github.com/godotengine/godot/assets/48926464/c31770de-55c3-403a-8d91-07fc1184cae1

Note: It is not necessary to open or create a scene, just follow the steps shown in the video.

### Minimal reproduction project

N/A
mat3 orthonormalize(mat3 m) {
	vec3 x = normalize(m[0]);
	vec3 y = normalize(m[1] - x * dot(x, m[1]));
	vec3 z = m[2] - x * dot(x, m[2]);
	z = normalize(z - y * (dot(y,m[2])));
	return mat3(x,y,z);
}
void vertex() {
	mat3 mv = orthonormalize(mat3(MODELVIEW_MATRIX));
	mv = inverse(mv);
	VERTEX += NORMAL*0.008;
	vec3 camera_dir_local = mv * vec3(0,0,1);
	vec3 camera_up_local = mv * vec3(0,1,0);
	mat3 rotation_matrix = mat3(cross(camera_dir_local, camera_up_local), camera_up_local, camera_dir_local);
	VERTEX = rotation_matrix * VERTEX;
}
void fragment() {
	ALBEDO = albedo.rgb;
	ALPHA = albedo.a;
}
)");
					border_mat->set_shader(border_shader);
					border_mat->set_shader_parameter("albedo", Color(0.75, 0.75, 0.75, col.a / 3.0));
					rotate_gizmo[3] = Ref<ArrayMesh>(memnew(ArrayMesh));
					rotate_gizmo[3]->add_surface_from_arrays(Mesh::PRIMITIVE_TRIANGLES, arrays);
					rotate_gizmo[3]->surface_set_material(0, border_mat);
				}
			}
			/
			{