So I understand exactly what you're saying, but I'm not sure you've thought this through: a company that is openly hostile to side projects is likely to be the worst case scenario when it comes to the commercialization of side projects that weren't disclosed to it.
I'm not quite sure this is good general advice. It may work for the top 0.01% of talent in Silicon Valley who can quit their job and find another one right away, but that's not the case for the vast majority of tech folks. My company has an extremely hostile stance towards side projects, which is pretty crappy and demoralizing, but there's no way in hell I'm going to quit over it, particularly if I have nothing else lined up. Best to just put side projects on "pause" if you're working in a place you think would try to grab it.