### Godot version

v4.0.beta14.official [28a24639c]

### System information

Windows 10, OpenGL

### Issue description

Vulkan and Mobile:
![Godot_v4 0-beta14_win64_kEcRNiMfNJ](https://user-images.githubusercontent.com/7782218/213967627-8e8755d9-2fe2-43b3-b197-f9f2840b7580.gif)

OpenGL:
![Godot_v4 0-beta14_win64_MQ233TZuPq](https://user-images.githubusercontent.com/7782218/213967651-ae463a6f-c867-4312-bdf1-525e1d7def01.gif)

At first I thought it was related to `set_buffer()`, but it turned out that `set_instance_*` also work incorrectly.
Probably the custom information is also set incorrectly, but I haven't checked it yet.

### Steps to reproduce

* Open MRP
* In the editor, select `MeshInstance3D` node and change the `Count` property
* -- or --
* Start the project and move the slider

You can also switch the renderer to Vulkan and compare.

### Minimal reproduction project

[set_buffer().zip](https://github.com/godotengine/godot/files/10476834/set_buffer.zip)

}
	glBindBuffer(GL_ARRAY_BUFFER, 0);
	s->vertex_count = p_surface.vertex_count;
	if (p_surface.format & RS::ARRAY_FORMAT_BONES) {
		mesh->has_bone_weights = true;
	}
	if (p_surface.index_count) {
		bool is_index_16 = p_surface.vertex_count <= 65536 && p_surface.vertex_count > 0;
		glGenBuffers(1, &s->index_buffer);
		glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, s->index_buffer);
		GLES3::Utilities::get_singleton()->buffer_allocate_data(GL_ELEMENT_ARRAY_BUFFER, s->index_buffer, p_surface.index_data.size(), p_surface.index_data.ptr(), GL_STATIC_DRAW, "Mesh index buffer");
		glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0); 
		s->index_count = p_surface.index_count;
		s->index_buffer_size = p_surface.index_data.size();
		if (p_surface.lods.size()) {
			s->lods = memnew_arr(Mesh::Surface::LOD, p_surface.lods.size());
			s->lod_count = p_surface.lods.size();
			for (int i = 0; i < p_surface.lods.size(); i++) {
				glGenBuffers(1, &s->lods[i].index_buffer);
				glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, s->lods[i].index_buffer);
				GLES3::Utilities::get_singleton()->buffer_allocate_data(GL_ELEMENT_ARRAY_BUFFER, s->lods[i].index_buffer, p_surface.lods[i].index_data.size(), p_surface.lods[i].index_data.ptr(), GL_STATIC_DRAW, "Mesh index buffer LOD[" + itos(i) + "]");
				glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0); 
				s->lods[i].edge_length = p_surface.lods[i].edge_length;
				s->lods[i].index_count = p_surface.lods[i].index_data.size() / (is_index_16 ? 2 : 4);
				s->lods[i].index_buffer_size = p_surface.lods[i].index_data.size();
			}
		}
	}
	ERR_FAIL_COND_MSG(!p_surface.index_count && !p_surface.vertex_count, "Meshes must contain a vertex array, an index array, or both");
	s->aabb = p_surface.aabb;