I think the entire idea of free and open source software is an example of people working for something without personal benefit. We wouldn't be talking on Lemmy right now if people hadn't created the ActivityPub protocol and developed the infrastructure, for instance. Hell, I've developed software purely out of spite.
I think if you remove the carrot from the equation, most people will still do the things they love and would still need the things that they need. If I didn't have to work 40-60 hours a week to afford things like healthcare and housing, I'd likely be working on software that improves the lives of those around me.