### Godot version

4.1.1.stable, 4.2.dev [6588a4a]

### System information

Godot v4.1.1.stable - Windows 10.0.19045 - Vulkan (Mobile) - dedicated NVIDIA GeForce GTX 1080 Ti (NVIDIA; 31.0.15.3640) - Intel(R) Core(TM) i7-8700K CPU @ 3.70GHz (12 Threads)

### Issue description

This is related to #72602, but since this also affects the Mobile renderer, this is likely a separate issue.

Setting the "Transparent BG" setting on a viewport is supposed to always keep the background transparent. On the Forward+ renderer, this setting is respected for all Environment Background Modes . On both the Mobile and Compatibility renderers, using the "Clear Color" background mode works with the transparent background, but using a "Custom Color" background does not render it as transparent.

Using Custom Color:
![bug](https://github.com/godotengine/godot/assets/607715/63032a9b-be99-459e-a4f6-a84faa0d7dc0)

Using Clear Color:
![clear](https://github.com/godotengine/godot/assets/607715/5c839062-a3b0-4fd9-9a8d-ff169eec7bfd)

### Steps to reproduce

1. Add a SubViewport to render some 3D scene and a way to view it (eg. a Sprite2D using the viewport as its texture)
2. Enable the "Transparent BG" option on the SubViewport
3. Setup an Environment for the 3D scene being rendered to the SubViewport (either on the Camera3D node or on a WorldEnvironment node)
4. Change the Background Mode of the Environment to Custom Color.

### Minimal reproduction project

[SkyTest.zip](https://github.com/godotengine/godot/files/12135972/SkyTest.zip)

if (ginstance->data->cast_double_sided_shadows) {
		flags |= GeometryInstanceSurfaceDataCache::FLAG_USES_DOUBLE_SIDED_SHADOWS;
	}
	if (has_alpha || p_material->shader_data->depth_draw == SceneShaderForwardMobile::ShaderData::DEPTH_DRAW_DISABLED || p_material->shader_data->depth_test == SceneShaderForwardMobile::ShaderData::DEPTH_TEST_DISABLED) {
		
		flags |= GeometryInstanceSurfaceDataCache::FLAG_PASS_ALPHA;
		if ((p_material->shader_data->uses_depth_prepass_alpha || p_material->shader_data->uses_alpha_antialiasing) && !(p_material->shader_data->depth_draw == SceneShaderForwardMobile::ShaderData::DEPTH_DRAW_DISABLED || p_material->shader_data->depth_test == SceneShaderForwardMobile::ShaderData::DEPTH_TEST_DISABLED)) {
			flags |= GeometryInstanceSurfaceDataCache::FLAG_PASS_DEPTH;
			flags |= GeometryInstanceSurfaceDataCache::FLAG_PASS_SHADOW;
		}
	} else {
		flags |= GeometryInstanceSurfaceDataCache::FLAG_PASS_OPAQUE;
		flags |= GeometryInstanceSurfaceDataCache::FLAG_PASS_DEPTH;
		flags |= GeometryInstanceSurfaceDataCache::FLAG_PASS_SHADOW;
	}
	if (p_material->shader_data->uses_particle_trails) {
		flags |= GeometryInstanceSurfaceDataCache::FLAG_USES_PARTICLE_TRAILS;
	}
	SceneShaderForwardMobile::MaterialData *material_shadow = nullptr;
	void *surface_shadow = nullptr;
	if (!p_material->shader_data->uses_particle_trails && !p_material->shader_data->writes_modelview_or_projection && !p_material->shader_data->uses_vertex && !p_material->shader_data->uses_discard && !p_material->shader_data->uses_depth_prepass_alpha && !p_material->shader_data->uses_alpha_clip && !p_material->shader_data->uses_alpha_antialiasing) {
		flags |= GeometryInstanceSurfaceDataCache::FLAG_USES_SHARED_SHADOW_MATERIAL;
		material_shadow = static_cast<SceneShaderForwardMobile::MaterialData *>(RendererRD::MaterialStorage::get_singleton()->material_get_data(scene_shader.default_material, RendererRD::MaterialStorage::SHADER_TYPE_3D));
		RID shadow_mesh = mesh_storage->mesh_get_shadow_mesh(p_mesh);
		if (shadow_mesh.is_valid()) {
			surface_shadow = mesh_storage->mesh_get_surface(shadow_mesh, p_surface);
		}
	} else {
		material_shadow = p_material;
	}