There might also be a clause in a salaried employee's contract that specifically requires them to notify the employer of any other work they are doing and get permission, precisely because otherwise the employer could end up in trouble under working time rules through no fault of their own.
As I understand it, this area can get very tricky because you have several general positions in law here that might be in conflict. For example, normally restraint of trade is not allowed, but there is also an implicit condition in any employment contract that the employee will properly serve their employer and that might include not doing other things that would interfere with their responsibilities as an employee. Then there is the whole question of whether work can be done off the clock for a salaried employee given there are limits on working hours and minimum wage requirements (though the latter probably won't be a relevant factor for anyone writing software). There have been related questions about people who are on call and they can get messy so it is not hard to imagine a case about IP rights getting messy with similar arguments being made by both sides.
Again, what OP needs here is a real employment lawyer. Without seeing the contract and other relevant information the most we can do is discuss the general issues, and even then and when this information all came from real lawyers, I am still cautious because my knowledge might be out of date or there might be other relevant factors we didn't discuss.