Leaving the US as a non-immigrant always carries a small amount of risk: CBP can always decide to refuse your next admission, even with a visa. After the recent spate of tech layoffs some H1-B holders have been asked to show recent payslips at the border to prove their continued employment, for example.
If you’re super unlucky (with your citizenship, or even just sharing a name with someone on a list) visa renewals can be delayed by months to years for security checks (“administrative processing”).
There are also some green card routes which require a period where you simply can’t leave the US without abandoning your application, after which you’ll be refused entry as a non-immigrant and will need to do the entire multi-year immigrant visa process from your home company. H1-B holders avoid this, fortunately, but TN holders and tourists who get married and decide to stay can get caught out here.
tl;dr: the US immigration system is actively user-hostile.