When pruning header search paths (to reduce the number of modules we need to build explicitly), we can't prune the search paths used in (transitive) dependencies of a module. Otherwise, we could end up with either of the following dependency graphs:
X:<hash1> -> Y:<hash2> X:<hash1> -> Y:<hash3>
depending on the search paths of the translation unit we discovered X and Y from.
This patch fixes that.
Depends on D121295.
Note that clang-format wants you to do something here.