I like to think of it this way: if those nations didn't fund new vaccine development in record time, it would take even longer for everybody else to get a vaccine. The fact that they are getting the vaccines first is what motivated the spending in the first place. Sure it's selfish, but it's human nature to take care of your own first.