### Godot version

508a5bf16ea50552c56539da4c96ea13fdf8853e

### System information

Windows 10, Intel i9-11900K

### Issue description

Godot runs fine in the Editor but any test run of a (3D) scene freezes the window up.
Even a test scene with just a single Node3D freezes.

All the test project runs fine with slightly older versions of master / Godot 4.1.

There are no errors but after bisecting it the problem points at changes from pr https://github.com/godotengine/godot/pull/76945 so properly some kind of thread deadlock.

![bisect_result](https://github.com/godotengine/godot/assets/52464204/85442c3c-7df2-43ca-85ef-e555055eec3d)

_edit_

Seems to be caused by ProjectSettings `threading/worker_pool/max_threads` set to 0 and `shader_compiler/shader_cache/enabled`=false

### Steps to reproduce

set ProjectSettings `threading/worker_pool/max_threads` to 0 and `shader_compiler/shader_cache/enabled`=false and testrun a scene from the Editor.

### Minimal reproduction project

[WorkerThreadPoolIssue.zip](https://github.com/godotengine/godot/files/11489032/WorkerThreadPoolIssue.zip)
ClassDB::bind_method(D_METHOD("add_task", "action", "high_priority", "description"), &WorkerThreadPool::add_task, DEFVAL(false), DEFVAL(String()));
	ClassDB::bind_method(D_METHOD("is_task_completed", "task_id"), &WorkerThreadPool::is_task_completed);
	ClassDB::bind_method(D_METHOD("wait_for_task_completion", "task_id"), &WorkerThreadPool::wait_for_task_completion);
	ClassDB::bind_method(D_METHOD("add_group_task", "action", "elements", "tasks_needed", "high_priority", "description"), &WorkerThreadPool::add_group_task, DEFVAL(-1), DEFVAL(false), DEFVAL(String()));
	ClassDB::bind_method(D_METHOD("is_group_task_completed", "group_id"), &WorkerThreadPool::is_group_task_completed);
	ClassDB::bind_method(D_METHOD("get_group_processed_element_count", "group_id"), &WorkerThreadPool::get_group_processed_element_count);
	ClassDB::bind_method(D_METHOD("wait_for_group_task_completion", "group_id"), &WorkerThreadPool::wait_for_group_task_completion);
}
WorkerThreadPool::WorkerThreadPool() {
	singleton = this;
}
WorkerThreadPool::~WorkerThreadPool() {
	finish();
}