It's a bad thing when the job is advertised: "Volunteer/Unpaid".
It is easy enough to have a volunteering agreement that catches this with clauses. Open sourcing the code won’t help with that scenario anyway.
Open source what, exactly? You point makes literally zero sense