Sounds like altruism to me.
I do suspect "what the hell, may as well push it to github" probably starts more open-source projects than any other thought.
I don't think to myself, "I can't wait to get home from work and selflessly help others!" I think to myself, "I can't wait to get home from work and crack open that really interesting problem that I've only been able to give a third of my brain to today." If the fruits of the latter result in someone else saying it's altruistic---that's cool. But don't try to tell me I'm doing it because it's altruistic. I'm not. (Being called altruistic is kind of funny. It's either a wonderful compliment or a condescending snub of youth/naivete. In my experience, anyway.)
FWIW, I suspect we're on the same page. I'm just trying to clarify the point I was trying to make to the original parent, because I think that's getting lost.
Please consider the parent I responded to. It was citing motivation. My motivation is passion for the craft; not impersonal sacrifice for the greater good (even if you observe it that way, that's not what motivates me to participate in open source).
Or neither. I create open source libraries because I love to code and because I love to share what I built with as many folks as I can. Idealism, altruism or concern of my reputation is not required. (I can't help but think that the subtext of those terms is "people who do open source in their free time are naive," but that would not be a charitable interpretation. Still, that's the impression I'm getting from your comment.)