The polio vaccine was mandated five years after it was invented, and that was in the early days of the field.
Mass vaccination is the only way to stop transmission, of course, you just can’t have some people vaccinated and others not, vaccines don’t work like that. The exemptions have never been very deep (very few takers each year), but if they exceed something like 5%, then an adjustment must be made. Washington state for example, revoked personal and philosophical exemptions for MMR vaccines after an outbreak. Religious exemptions are still allowed, but those have a much higher bar than a philosophical exemption. Medical exemptions are always allowed, they are one major reason why most everyone else needs to get vaccinated in the first place (because people who can’t get the vaccine are at risk from transmission).
I guess one could argue that everyone that wants to should get vaccinated to better protect those who don’t want to be vaccinated. That makes sense, but hardly seems fair.