I ended up not changing the behavior of the depsgraph evaluator task pool in rBed1fc9d96bba: BLI: support disabling task isolation in task pool, because it could cause another deadlock (T76553).
I still would like to enable the new check in assert_on_valid_thread. The simplest solution for now is to use task isolation explicitly in deg_task_run_func. Note that schedule_children is not in the isolated region.
Going forward, I'd like to either fix the need for task isolation or to move the call run_in_isolated_region further down the stack to where it is really needed. This should be done in a separate step though.