I would disagree. Consulting work exposes you to more liability than being an employee. If you drop a consulting job midstream to take a great job offer, you're likely to get sued.
As someone who was contracting we always had notice periods in contracts. Let’s not forget it works both ways and contractors are more often than not the first to go.
When I was freelancing, I would have a Master Service Agreement that spelled out the "rules of engagement" and the actual work was in a Statement Of Work that lasted roughly 3 months. Gave each party the ability to pull the rip cord
I’ve done consulting; you have control about how you write your contract. If they want to lock you up for a long period they should be willing to pay for it.