Who is more likely to be hired for paying work: the guy whose code you have benefitted from or the guy whose code you haven't seen?
I believe there is such thing as 'corporate stewardship' and companies ought to give back to the communities that host them. With remote work, and independent workers I believe that responsibility to give back falls on the individual.
I've surely benefitted in my life from open-source software. My income depends on my use of it, so I feel not just a desire but a duty to release work for others in the same way.
It's not direct, but the more code I put out there the more my industry thrives. The more my industry thrives the more work there is in it. The more work there is in my industry the easier it will be for me to find work.
It's a roundabout way of doing it, but I like to think of it as watering the garden I get my food from, instead of harvesting it.