I’m really not sure whether that’s an incentive. It’s just all you can do if you have more money than you can spend.
I know I directly benefited from a Carnegie library as a kid. With philanthropy at this scale there is potential to benefit humanity in a way that may otherwise not happen. Compare this to other paths that wealthy people have taken, such as creating trusts that mostly benefit the family and still exist today (e.g. Rockefellers).
As for philanthropy, I'm reminded of a billionaire friend who said his fortune was more of an administrative burden than his business ever was.
An incentive to the egocentric. I don't think that is ever the primary motivator though. I'd like to believe most people just like helping others.