As an alternative, I know some companies will let you voluntarily cut down your hours in exchange for a pay cut. With tech salaries being what they are, you could make a comfortable living while only working half-time in many cases. And that way you don't have to worry about what legally counts as "on company time".
Work in good faith and read up on your rights, but yea even with all that you could unwittingly get yourself in some form of trouble. I’ve weighed the risks and feel comfortable but YMMV.
Doesn’t even matter anyway, I’m no longer at an age where I fantasize about making big money from building pointless side projects. It’s kind of juvenile to think these sort of half-serious side hustles will ever be anything more than a waste of time in the long run. I’m content with drawing a big six-figure tech salary with as little effort as possible and funneling cash into my growing portfolio of investments, which is what will actually make me richer without going through the bullshit of starting a company and providing customer support. Reading up on companies and analyzing which ones will be the best investments is actually something I enjoy doing.
If you meet these requirements you can cut out all the bullshit from your day and just focus on the meaty part that you actually get paid for.