### Godot version

4.1 and 4.0.3 debug build

### System information

OS: Manjaro Linux x86_64
Kernel: 6.1.38-1-MANJARO 
CPU: AMD Ryzen 5 5600X (12) @ 3.700GHz 
GPU: NVIDIA GeForce RTX 3070 Ti
X11 backend
OpenGL API 3.3.0 NVIDIA 535.54.03

### Issue description

Game crashes silently after switching to compatibility rendering method. 
It's a pure 2D game. Forward+ and mobile work fine.

logs in console:

[4.0.3 debug build](https://github.com/Calinou/godot-debug-builds):
```
================================================================
handle_crash: Program crashed with signal 11
Engine version: Godot Engine v4.0.3.stable.custom_build (5222a99f5d38cd5346254cefed8f65315bca4fcb)
Dumping the backtrace. Please include this when reporting the bug to the project developer.
[1] /usr/lib/libc.so.6(+0x39ab0) [0x7fe425c9dab0] (??:0)
[2] /usr/lib/libGLdispatch.so.0(+0x4d6c9) [0x7fe4176de6c9] (??:0)
-- END OF BACKTRACE --
================================================================

```

4.1 official:
```
================================================================
handle_crash: Program crashed with signal 11
Engine version: Godot Engine v4.1.stable.official (970459615f6b2b4151742ec6d7ef8559f87fd5c5)
Dumping the backtrace. Please include this when reporting the bug to the project developer.
[1] /usr/lib/libc.so.6(+0x39ab0) [0x7fc48dfd9ab0] (??:0)
[2] /usr/lib/libGLdispatch.so.0(+0x4d6c9) [0x7fc48462b6c9] (??:0)
-- END OF BACKTRACE --
================================================================

```


### Steps to reproduce

Switch to compatibility rendering method and run game in editor.

### Minimal reproduction project
[signal11.zip](https://github.com/godotengine/godot/files/12061947/signal11.zip)



FUNC2(viewport_set_scaling_3d_scale, RID, float)
	FUNC2(viewport_set_fsr_sharpness, RID, float)
	FUNC2(viewport_set_texture_mipmap_bias, RID, float)
	FUNC2(viewport_set_update_mode, RID, ViewportUpdateMode)
	FUNC1RC(RID, viewport_get_render_target, RID)
	FUNC1RC(RID, viewport_get_texture, RID)
	FUNC2(viewport_set_disable_2d, RID, bool)
	FUNC2(viewport_set_environment_mode, RID, ViewportEnvironmentMode)
	FUNC2(viewport_set_disable_3d, RID, bool)
	FUNC2(viewport_set_canvas_cull_mask, RID, uint32_t)
	FUNC2(viewport_attach_camera, RID, RID)
	FUNC2(viewport_set_scenario, RID, RID)
	FUNC2(viewport_attach_canvas, RID, RID)
	FUNC2(viewport_remove_canvas, RID, RID)
	FUNC3(viewport_set_canvas_transform, RID, RID, const Transform2D &)
	FUNC2(viewport_set_transparent_background, RID, bool)
	FUNC2(viewport_set_snap_2d_transforms_to_pixel, RID, bool)
	FUNC2(viewport_set_snap_2d_vertices_to_pixel, RID, bool)
	FUNC2(viewport_set_default_canvas_item_texture_filter, RID, CanvasItemTextureFilter)
	FUNC2(viewport_set_default_canvas_item_texture_repeat, RID, CanvasItemTextureRepeat)
	FUNC2(viewport_set_global_canvas_transform, RID, const Transform2D &)
	FUNC4(viewport_set_canvas_stacking, RID, RID, int, int)
	FUNC3(viewport_set_positional_shadow_atlas_size, RID, int, bool)
	FUNC3(viewport_set_sdf_oversize_and_scale, RID, ViewportSDFOversize, ViewportSDFScale)
	FUNC3(viewport_set_positional_shadow_atlas_quadrant_subdivision, RID, int, int)
	FUNC2(viewport_set_msaa_2d, RID, ViewportMSAA)
	FUNC2(viewport_set_msaa_3d, RID, ViewportMSAA)
	FUNC2(viewport_set_screen_space_aa, RID, ViewportScreenSpaceAA)
	FUNC2(viewport_set_use_taa, RID, bool)
	FUNC2(viewport_set_use_debanding, RID, bool)