### Godot version

v4.2.beta1.official [b1371806a]

### System information

Ubuntu 22.04.3 LTS 22.04 - X11 - GLES3 (Compatibility) - AMD Radeon RX 560 Series (polaris11, LLVM 15.0.7, DRM 3.42, 5.15.0-88-generic) () - AMD Ryzen 3 1200 Quad-Core Processor (4 Threads)

### Issue description

![image](https://github.com/godotengine/godot/assets/1330325/7a986599-5a68-42a4-beb1-5d3b4bf7db6b)
![image](https://github.com/godotengine/godot/assets/1330325/e8b8546b-b47b-4add-9567-7f70709ab03c)

Culling 3D goes bellow 60 fps even with just about 50 simple animated models. With v4.2.dev6.official [57a6813bb] many more models can be spawned without fps drop. However, both versions do show high cpu usage for culling 3D. Without animations there's barely any usage.

### Steps to reproduce

Spawn models with animation with the Compatibility renderer.

### Minimal reproduction project

[CullMRP.zip](https://github.com/godotengine/godot/files/13400514/CullMRP.zip)

actions.write_flag_pointers["POSITION"] = &uses_position;
	actions.usage_flag_pointers["TANGENT"] = &uses_tangent;
	actions.usage_flag_pointers["BINORMAL"] = &uses_tangent;
	actions.usage_flag_pointers["ANISOTROPY"] = &uses_tangent;
	actions.usage_flag_pointers["ANISOTROPY_FLOW"] = &uses_tangent;
	actions.usage_flag_pointers["COLOR"] = &uses_color;
	actions.usage_flag_pointers["UV"] = &uses_uv;
	actions.usage_flag_pointers["UV2"] = &uses_uv2;
	actions.usage_flag_pointers["CUSTOM0"] = &uses_custom0;
	actions.usage_flag_pointers["CUSTOM1"] = &uses_custom1;
	actions.usage_flag_pointers["CUSTOM2"] = &uses_custom2;
	actions.usage_flag_pointers["CUSTOM3"] = &uses_custom3;
	actions.usage_flag_pointers["BONE_INDICES"] = &uses_bones;
	actions.usage_flag_pointers["BONE_WEIGHTS"] = &uses_weights;
	actions.uniforms = &uniforms;
	Error err = MaterialStorage::get_singleton()->shaders.compiler_scene.compile(RS::SHADER_SPATIAL, code, &actions, path, gen_code);
	ERR_FAIL_COND_MSG(err != OK, "Shader compilation failed.");
	if (version.is_null()) {
		version = MaterialStorage::get_singleton()->shaders.scene_shader.version_create();
	}
	blend_mode = BlendMode(blend_modei);
	alpha_antialiasing_mode = AlphaAntiAliasing(alpha_antialiasing_modei);
	depth_draw = DepthDraw(depth_drawi);
	depth_test = DepthTest(depth_testi);
	cull_mode = Cull(cull_modei);
	vertex_input_mask = uint64_t(uses_normal);
	vertex_input_mask |= uses_tangent << 1;
	vertex_input_mask |= uses_color << 2;
	vertex_input_mask |= uses_uv << 3;
	vertex_input_mask |= uses_uv2 << 4;