I've once been in that situation where the company tried to introduce a contract rewrite with the standard lack of clarity over whether it applied to everything, including outside work (e.g. open source contributions). There were enough open source developers in the company that this was a big problem.
So we all just refused to sign the contract change.
The situation stalled for a few months, and they eventually backed down and wrote in a clarification. This was the UK, so we actually had rights and couldn't just be arbitrarily sacked, and everyone was aware that pursuing individuals over this would lead to a mass exodus and the destruction of the company.
Not protected in the formal sense, but the old one still applied with its month's notice in both directions. Really the key factor was the difficulty in replacing developers.
So we all just refused to sign the contract change.
The situation stalled for a few months, and they eventually backed down and wrote in a clarification. This was the UK, so we actually had rights and couldn't just be arbitrarily sacked, and everyone was aware that pursuing individuals over this would lead to a mass exodus and the destruction of the company.