### Godot version

4.0.2.stable (7a0977c)

### System information

Ubuntu 22.04, x86_64, LLVM

### Issue description

When performing a dedicated server export with:
- a `ShaderMaterial` (a `canvas_item` shader used on a `Panel` in the example below)
- a build with `disable_3d=yes`

the resulting export gives the following error when run:
```
ERROR: Cannot get class 'PlaceholderMaterial'.
   at: instantiate (core/object/class_db.cpp:326)
ERROR: res://main.tscn:Resource of unrecognized type in file: PlaceholderMaterial.
   at: load (core/io/resource_format_binary.cpp:778)
ERROR: Failed loading resource: res://.godot/exported/206107301/export-3070c538c03ee49b7677ff960a3f5195-main.scn. Make sure resources have been imported by opening the project in the editor at least once.
   at: _load (core/io/resource_loader.cpp:223)
ERROR: Failed loading scene: res://main.tscn
   at: start (main/main.cpp:2965)
```

I would expect things to work here without an error - there's no 3D in use here and a normal export with the same build does run as expected.

### Steps to reproduce

1. Build godot with `disable_3d=yes`.
2. Create a new project, and add a `Panel` node.
3. Add a `canvas_item` shader as the material for the `Panel` node.
4. Perform a dedicated server export using the build from step 1.
5. Run the exported binary and observe the error.

### Minimal reproduction project

[DedicatedServer2DTest.zip](https://github.com/godotengine/godot/files/11597444/DedicatedServer2DTest.zip)

ClassDB::add_compatibility_class("NavigationRegion", "NavigationRegion3D");
	ClassDB::add_compatibility_class("Navigation2DServer", "NavigationServer2D");
	ClassDB::add_compatibility_class("NavigationServer", "NavigationServer3D");
	ClassDB::add_compatibility_class("OmniLight", "OmniLight3D");
	ClassDB::add_compatibility_class("PanoramaSky", "Sky");
	ClassDB::add_compatibility_class("Particles", "GPUParticles3D");
	ClassDB::add_compatibility_class("Particles2D", "GPUParticles2D");
	ClassDB::add_compatibility_class("ParticlesMaterial", "ParticleProcessMaterial");
	ClassDB::add_compatibility_class("Path", "Path3D");
	ClassDB::add_compatibility_class("PathFollow", "PathFollow3D");
	ClassDB::add_compatibility_class("PhysicalBone", "PhysicalBone3D");
	ClassDB::add_compatibility_class("Physics2DDirectBodyState", "PhysicsDirectBodyState2D");
	ClassDB::add_compatibility_class("Physics2DDirectSpaceState", "PhysicsDirectSpaceState2D");
	ClassDB::add_compatibility_class("Physics2DServer", "PhysicsServer2D");
	ClassDB::add_compatibility_class("Physics2DShapeQueryParameters", "PhysicsShapeQueryParameters2D");
	ClassDB::add_compatibility_class("Physics2DTestMotionResult", "PhysicsTestMotionResult2D");
	ClassDB::add_compatibility_class("PhysicsBody", "PhysicsBody3D");
	ClassDB::add_compatibility_class("PhysicsDirectBodyState", "PhysicsDirectBodyState3D");
	ClassDB::add_compatibility_class("PhysicsDirectSpaceState", "PhysicsDirectSpaceState3D");
	ClassDB::add_compatibility_class("PhysicsServer", "PhysicsServer3D");
	ClassDB::add_compatibility_class("PhysicsShapeQueryParameters", "PhysicsShapeQueryParameters3D");
	ClassDB::add_compatibility_class("PinJoint", "PinJoint3D");
	ClassDB::add_compatibility_class("PlaneShape", "WorldBoundaryShape3D");
	ClassDB::add_compatibility_class("Position2D", "Marker2D");
	ClassDB::add_compatibility_class("Position3D", "Marker3D");
	ClassDB::add_compatibility_class("ProceduralSky", "Sky");
	ClassDB::add_compatibility_class("RayCast", "RayCast3D");
	ClassDB::add_compatibility_class("RayShape", "SeparationRayShape3D");
	ClassDB::add_compatibility_class("RayShape2D", "SeparationRayShape2D");
	ClassDB::add_compatibility_class("RemoteTransform", "RemoteTransform3D");