Apply module_name_overrides and module_blocklist to genrule too.

As part of this I've factored out the logic into a separate function, as
it is used in several places.

Bug: 293289578
Test: Ran on old bitflags and protobuf crates
Change-Id: I5f14cc4001025d01669e611ed03e45532a007147
2 files changed