Move most of directory_all_unreachable into a backend callback
After my patch on legacy/trac#16695 (moved), the blob becomes smaller, but still quite scary (311 functions in our biggest SCC). If we move the body of directory_all_unreachable into a callback, we can chop that by nearly half.