The general position under English law is that IP rights created by an employee within the course of employment automatically belong to the employer; where there is any doubt as to whether an employee or their employer owns IP rights, the relevant legislation largely favours employers."
It's been that way for decades, while the UK was in EU.
I had to get it written into an employment contract that Open Source activity outside of work was my own.
The idea behind this is that your employer pays not just for your time, but also for the skills you acquire during your work. Therefore, the output of those skills has at least partial ownership. There's a huge gray area which contains liabilities and opportunities for both sides, which is why most companies insist on signing off on personal projects. The alternative is fighting it out in front of a judge, should it ever come to that.
I heard a story of someone who had this permission revoked because they worked weekends as a DJ in Berlin, and would often take sick days/turn up late on Mondays to deal with the hangover.
Also it is legally enforceable as in it can be considered a valid and completely legal exception to usual termination protection.
It should be if consideration is provided.
I do think there's an argument to be made whether the base salary counts as consideration for things outside of the defined working hours though.
I might be wrong but I don't think this kind of thing would work (legally speaking) in the EU.