Otherwise, if its a classic "Here is a salary and package, we own all your relevant ideas from here on" deal, I'd say that is highly unethical behavior on the company's part, and is a case of wage theft.
Should the employee be barred from moonlighting too? Not unless the company is willing to pay for said time.
To quote Martin Luther King Jr.:
"I have almost reached the regrettable conclusion that the Negro's great stumbling block in his stride toward freedom is not the White Citizen's Counciler or the Ku Klux Klanner, but the white moderate, who is more devoted to "order" than to justice; who prefers a negative peace which is the absence of tension to a positive peace which is the presence of justice; who constantly says: "I agree with you in the goal you seek, but I cannot agree with your methods of direct action"; who paternalistically believes he can set the timetable for another man's freedom;"
https://www.africa.upenn.edu/Articles_Gen/Letter_Birmingham....
The former I can often have a sensical conversation with and perhaps change their mind on some issues, the latter feeling an outright opposition to taking action or altering their views.