Factor out common checks from module map deserialization. No functionality change.