An H1B is a good example. The company says they don’t need you, you have to leave the country.
I have worked under different visa in different countries. In most cases, if you lose your job (fired, downsizing, whatever), you need to leave in a few months (or find a job very quickly). This is not unique to the US H1B system.