rules/build-prog: Ensure programs depend upon their transitive deps
Previously programs only depended upon the direct dependencies; while I
would have thought that this would be sufficient, somehow we were
getting to the link step of building ghc-pkg before ghc-boot-th was
built (despite the fact that ghc-boot has a direct dependency on
See Trac #12078.
(cherry picked from commit 5d80d14196ef048ffe037b2d92af2e9af0cb9e19)