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