You wrap your infra/core functionality into an os project, and keep the businessy things in the private repo.
You get to work on it during your work hours. It inevitably ends up much better documented and tested code than the usual company developed tooling. And you get to keep it when you leave.
No need to spend time on it at home if you don’t want to.
And the company benefits as well as it now has much better internal codebase, people might consider maintaining it even after they’ve left the company, and it acts like a pr/recruitment hook.
The flip side of this (and I don't think it's what your advocating for, btw), is companies like Gatsby who's entire product is "open source", and when they have a deficiency in it they ask/expect you to submit PR to fix it, but then will immediately turn around and sell that on to others.
No thanks, im not going to write code and give it to you, to fix your broken product, for you to make money off it.
I know some companies are famously leave-water-at-home-we-drink-koolaid-here cough! (apple) cough!
If you make it a very nice looking OS project, most of the time they are either on board or don't care too much.
But I really check for this at the interview stage, and they must have a really good reason not to, compensated accordingly.
Didn't Apple start doing OS as well though? I think there are a bunch of projects from them already.
They have opened swift, but that's sort of a funnel anyway.
The real problem is folks who work there say it's really hard to open source stuff as an employee.