Fixes scheduler bug caused by updating priority on pruned tasks

If a task is pruned in the scheduler but a task that depends on it still exists,
the priority update recursion in add_task becomes vulnerable to encountering the
pruned task before it has been added back. Even worse, if the task that depends
on the pruned task is done, the pruned task will never be rescheduled.

This adds a test to demonstrate the code flaw and fixes it by skipping over
missing tasks in priority update. The test also shows that the priority will
still be updated appropriately if the task is eventually added back.