add unloading of tasks to GC (#8671)
### Description
Inactive tasks can be completely unloaded. This disconnects them from the graph and frees nearly all memory (except for the TaskId mapping).
When running GC for a task we check if it's inactive and unload it when it is.
But we also need to enqueue a task for GC again when it becomes inactive. So we maintain a queue of potentially inactive tasks and walk the children during GC.