Being good for selfish reasons is not good and it does not work. You have to be good for selfless reasons first, only then it works. That’s the lesson.
Many people view their future self as an "other." Which means if your empathic machinery for others is atrophied, you'll also find it difficult to delay gratification and do the right thing by your future self.
Or to put it more optimistically, be kind to others and their life (and your own) will be all the better for it.