### 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)
task_mutex.lock();
		if (is_low_prio_waiting_for_another) {
			low_priority_tasks_awaiting_others--;
		}
		task->waiting--;
	}
	if (task->waiting == 0) {
		if (use_native_low_priority_threads && task->low_priority) {
			task->low_priority_thread->wait_to_finish();
			native_thread_allocator.free(task->low_priority_thread);
		}
		tasks.erase(p_task_id);
		task_allocator.free(task);
	}
	task_mutex.unlock();
	return OK;
}
WorkerThreadPool::GroupID WorkerThreadPool::_add_group_task(const Callable &p_callable, void (*p_func)(void *, uint32_t), void *p_userdata, BaseTemplateUserdata *p_template_userdata, int p_elements, int p_tasks, bool p_high_priority, const String &p_description) {
	ERR_FAIL_COND_V(p_elements < 0, INVALID_TASK_ID);
	if (p_tasks < 0) {
		p_tasks = threads.size();
	}
	task_mutex.lock();
	Group *group = group_allocator.alloc();
	GroupID id = last_task++;
	group->max = p_elements;
	group->self = id;
	Task **tasks_posted = nullptr;
	if (p_elements == 0) {