Signatures of historical demography and pathogen richness on MHC class I genes