Sometimes. This is not something generally expected of people, and newsworthy when it happens. Not all ideals are also selfless - some, like loyalty to one's God in expectation of an afterlife, is directly selfish.
> work their whole lives to give their children a better future
A combination of biological imperative and social pressure older than civilization; also pretty selfish.
> save for retirement
Most people can't really do that, especially not when living paycheck-to-paycheck. That's why retirement funds tend to be done in opt-out and usually socialized fashion.
> produce research on subjects that will only achieve tangible outcomes in the distant future
Even ignoring the status seekers, pure intellectual curiosity gives short-term emotional rewards. I doubt most researchers would be able to sustain their efforts if they didn't feel at least some immediate intellectual reward that outweighed their lowered (or sometimes non-existent) salaries.
My point isn't that individuals aren't capable of putting long-term benefits in front of their short-term interests. My point is that they aren't capable of doing it at scale, in a coordinated fashion. A lot of this boils down to coordination problems - when personal sacrifice has low marginal utility (i.e. you need to get a lot of people on-board to materialize the benefits) and high immediate cost, few people will choose the sacrifice, and even if a small group coordinates on this, the first person to defect will destroy it all.
The person who dies for “ideals” are mostly driven by false claims[0] about the nature of the afterlife.
Improving your child’s outcomes is a biologically preset desire.
Saving for retirement is still ultimately in one’s immediate self interest.
Producing theoretical research has the immediate benefit of recognition in their fields and the possibility of a “lottery win” outcome.
Saving for retirement is
[0] More precisely, claims they can't know to be true. (And are also almost certainly false.)