9mm indoors without ear protection would definitely make your ears ring for the rest of the day, but I'm not sure it would permanently destroy your hearing unless we're talking multiple mags worth without hearing protection. It is roughly 163 decibels out of a G17. AR-15 with a 16" barrel is closer to 165 decibels. The 3 decibel increase is 100% more sound energy, which hits the ear at about a 23-25% increase in perceived loudness at direct wave reverberation from gun to ear. More importantly though, the doubling of sound energy means it also hits your ear far harder on reflected sound from hard surfaces (walls/ceiling/floor). So an AR-15 is significantly louder than any 9mm handgun and poses far more unprotected ear risk discharging indoors.
Either will absolutely destroy your hearing. 300BLK might destroy it worse, but 9mm certainly can/will cause instantaneous hearing loss.
Unless we’re planning on only firing one round (which is how likely, exactly?), this argument is essentially moot.