It's kind of skewed with some sports having several events (swimming, gymnastics) where one person can earn many medals and many that are just one unique event.
Interesting to see some variations in the mix though, like 3 on 3 basketball.
Also 8 of his medals were with the sharkskin swimsuit which was immediately banned as it conferred an absolutely immense advantage to those wearing it.
Everyone else didn’t start wearing it and training with it at the same time that the sponsored players did. The Japanese players started using it the month before because they were 100% sure they would lose without it. Phelps lost to a German the next year when he wasn’t wearing the suit.
He lost the next year to a German wearing a similar suit while he wasn’t, so yes I think it’s highly likely that he wouldn’t have had the dominance he did with the suit if he wasn’t allowed to wear it. But of course there’s no way to know.