Plenty of people work more than one job. As long as someone does the work that's expected of them and performs their job duties well, it isn't any employer's business what someone does in their time off.
Actually, most tech companies have employment agreements that prevent exactly this sort of behavior. When you are dealing with IP, you don’t want this leaking to a competitor. And when you are a big tech company, almost any other tech company is potentially a competitor.
If companies don't want IP leaking, then society provides them plenty of avenues and incentives to prevent that from happening, from NDAs to fines and prison time.
If companies don't want employees working for anyone else, then they should compensate those employees for that privilege. They don't own anyone's free time unless they pay for that privilege.
In general they do pay for your time outside of work and you agree by taking the job.
Let's say you work strict hours 9am to 5pm M-F. On Thursday at 8:47pm you happen to think of a solution to a problem you're having at work. Are you suggesting the company should pay you more because the idea occurred outside of your strict hours?
In general, companies pay white collar workers / knowledge workers, for their knowledge. That happens regardless of when that knowledge is acquired. It seems pretty common sense and there are also plenty of laws to it up. Any other arrangement would seem full of issues.
Most companies have requirements on the handling of IP and conflicts of interest. Using separate workstations and working in two different industries solves this problem. Remember, most only require that IP relevant to their company and industry are owned by them.