Optimizing for human life would have meant spending a potentially unlimited amount of money. Maybe a few EU countries would be happy with that trade off, but the poorer countries wouldn't have been able to afford it.
The EU was in the difficult position, as either the eurosceptics in the poor countries would complain that the EU was throwing them to the wolves, or the eurosceptics in the rich countries would complain that they were having to subsidise the poor countries who refused to pay the full amount.
When faced with a global pandemic, vaccinating just your own country while your neighbours become a breeding ground for new variants isn't really solving the problem, especially if your neighbours are closely integrated with you and citizens have freedom of movement across borders. This is why we can't have nice things.