Eh, the truth is somewhere in the middle. I say this as someone who actually went through the process.
Sure you can switch employers while on an H1B. I did. But that's an extra moving part added to the process. It's extra effort added to both sides, employer and employee. They need to really want to hire you to go through all that. If it's a tiny startup, the amount of work might just be too much (and you wouldn't want to work for a tiny startup anyway, as an H1B worker).
Also, if you somehow lose your job as an H1B holder, you only have a limited time interval to get a new job. There's a lot of pressure to just accept any job that comes along, regardless of all other considerations.
Also, typecasting is very real. The whole H1B / greencard process really, really puts the pressure on you to stay in the same job description for a long time. It's not set in stone, and there are exceptions, but as a rule you're basically forced into a straightjacket.
Basically, if you're caught in this process, there's the freedom & opportunity Big Carrot dangling ahead at the end of many years of wait. Meanwhile, your hands are tied and your actions are to a large extent dictated by a faceless, remote bureaucracy that has the full power to decide your fate. It's extremely frustrating.