### Godot version

Godot 4.0 beta 14

### System information

Debian 11, X11 Nvidia proprietary driver, GLES3 Compatibility

### Issue description

When creating a new scene and add a Sprite2D node, the node image becomes corrupted when selecting the root node.
The problem is gone after saving & re-opening the editor.

![Screenshot from 2023-01-24 12-19-24](https://user-images.githubusercontent.com/94308700/214218462-979ed804-6128-4fbb-87d3-286de9db9e7f.png)

Selecting the root node:
![Screenshot from 2023-01-24 12-19-35](https://user-images.githubusercontent.com/94308700/214218528-944083f4-f5fc-4088-a6c8-7702215ce1a0.png)

The resource preview is wrong too.
![Screenshot from 2023-01-24 12-19-48](https://user-images.githubusercontent.com/94308700/214218557-34177eba-98cc-46aa-86f3-9f613899137a.png)


### Steps to reproduce

Pretty straightforward.

### Minimal reproduction project

Any sprite will do, i think.
xture->tex_id;
			rt->size = Size2i(texture->width, texture->height);
		} else {
			texture = get_texture(rt->texture);
			ERR_FAIL_COND(!texture);
			glGenTextures(1, &rt->color);
			glBindTexture(texture_target, rt->color);
			if (use_multiview) {
				glTexImage3D(texture_target, 0, rt->color_internal_format, rt->size.x, rt->size.y, rt->view_count, 0, rt->color_format, rt->color_type, nullptr);
			} else {
				glTexImage2D(texture_target, 0, rt->color_internal_format, rt->size.x, rt->size.y, 0, rt->color_format, rt->color_type, nullptr);
			}
			glTexParameteri(texture_target, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
			glTexParameteri(texture_target, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
			glTexParameteri(texture_target, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
			glTexParameteri(texture_target, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
		}
#ifndef IOS_ENABLED
		if (use_multiview) {
			glFramebufferTextureMultiviewOVR(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, rt->color, 0, 0, rt->view_count);
		} else {
#else
		{
#endif
			glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, rt->color, 0);
		}
		
		if (rt->overridden.depth.is_valid()) {
			texture = get_texture(rt->overridden.depth);
			ERR_FAIL_COND(!texture);
			rt->depth = texture->tex_id;
		} else {
			glGenTextures(1, &rt->depth);
			glBindTexture(texture_target, rt->depth);
			if (use_multiview) {
				glTexImage3D(texture_target, 0, GL_DEPTH_COMPONENT24, rt->size.x, rt->size.y, rt->view_count, 0, GL_DEPTH_COMPONENT, GL_UNSIGNED_INT, nullptr);
			} else {
				glTexImage2D(texture_target, 0, GL_DEPTH_COMPONENT24, rt->size.x, rt->size.y, 0, GL_DEPTH_COMPONENT, GL_UNSIGNED_INT, nullptr);
			}
			glTexParameteri(texture_target, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
			glTexParameteri(texture_target, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
			glTexParameteri(texture_target, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
			glTexParameteri(texture_target, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
		}
#ifndef IOS_ENABLED
		if (