This isn't really a new invariant; it effectively already existed due to existing DataLayout queries. But this makes it explicit.
This is technically not backward-compatible with the existing bitcode reader, but it's backward-compatible with the output of the bitcode writer, which is what matters in practice.
No testcase because I don't know a good way to write one.
Split off from D78403. (And modified a bit to handle the interaction between datalayout parsing and DataLayout::getProgramAddressSpace().)