Mandating vaccines is going a step further - it's forcing people to do an action, which might reduce their chances of causing harm in the future.
If the sole goal was to prevent people to cause harm to others, we should prevent people from driving (they hit others with their cars) or we should stop people from being drunk (they end up fighting others, and also driving drunk).
So clearly actually, the more nuanced answer is that society is, amongst other things, a balance between protecting others and personal liberty (and these things often fight against each other).
(I'm personally vaccinated, and think as a society everyone should be encouraged to vaccinate, but that it has to be an individual decision and that we shouldn't force people to put things in their body that they don't want to put into it).