improve fact cleanup performance
`delete_orphaned_facts` step is very slow, it is loading all fact names and checking if they have fact values associated with them, then trying to also delete fact values unnecessarily.
Fixes #28564 - improve performance of orphaned facts cleanup
This should greatly improve the performance of cleaning up orphaned
facts. First, we stop trying to delete fact_values for orphaned facts
since they don't exist. Then, instead of checking each compose fact's
descendants to see if they were all deleted, we get a set of all
remaining leaf's ancestors and delete any not on that list.