Fix assertion failure when combining build-tool-depends and --enable-documentation
The `setDocumentation` function was modifying the elaborated package
after the hash was computed. This led to the assertion failing as the
computed hash was different to what was computed in the initial install
plan.
Therefore in order to fix this we either needed to:
1. Set elabBuildHaddocks = False at the point where the hash is
initially computed.
2. Verify that elabBuildHaddocks = True will not lead to unexpected
results.
The latter has been implemented.
The elabBuildHaddocks option is only consulted in
`hasValidHaddockTargets`, at which point documentation building the
executable component is disabled because elabHaddockExecutables is
False.
In the added test we ensure this by checking that we didn't build
documentation for the executable which is built because of
build-tool-depends.
Fixes #6006 #8313