Sometimes the company can justify it if they provided something compensatory, like months of company-paid high-value training and skills development that significantly advanced your profession. Especially if the non-compete duration begins after that training ended buy while you still work for the company. Finish your training, stay at that company for the duration of the non-compete, then you're free to leave and work for a competitor if you want. Company gets their money's worth, and you're not stuck with a non-compete that begins the day you leave.
In a second case, I was actually able to negotiate it away. I ended up not taking that job for other reasons, but before that decision was made, they had retracted the need for it.
Anecdotal, but maybe useful.
(client): "Here is our standard contract"
(me): "Please remove the 12 months non compete clause"
(client): "How about 6 months non compete?"
(me): "No"
(client): "3 months?"
(me): "Fine, where do I sign?"
I don't mind 3 months non compete. I can take a longer holiday if I desperately need to go straight back. I never have and 6 months is probably ok as well.
It is mostly if I go somewhere else and it for some reasons finished early after a few months, then I am free to go wherever I choose.
I've joined a big company who said "this is the contract, sign it"