(#11641) Properly track blockers when generating additional resources
Previously, we would enqueue any unblocked resources as we added them to the
graph. These were our initial resources, with no dependencies, and served as a
starting place for traversal. However, we would
add_dynamically_generated_resources before traversing, which could add
additional resources and dependencies. We never accounted for these, causing
our measure of blockedness to become incorrect (a resource could have more
dependencies than we counted).
This is similar to the case of eval_generate adding additional resources. In
that case, we clear the blockers list and allow it to be recalculated on
demand. Unfortunately, that approach doesn't work for the case where we add
resources before traversing (as in add_dynamically_generated_resources),
because we wouldn't have a reliable list of resources to begin traversal with.
Now we no longer enqueue resources when adding them, and instead wait until
after we have called add_dynamically_generated_resources (which happens only
once). This allows us to add our root resources with the assurance they won't
change before we start evaluating them.