I can't think of a single case where there would be an "obvious" replacement for that person -- not just in the US, but anywhere in the world. In fact, most of those H1Bs I've worked with eventually end up switching to the O1 anyways (for reference, very few SWEs -- even at FAANGs -- would quality for the O1).
I hesitate to rely on my anecdotal experience but my opinion is that unless they are really high level programmers or whatnot they are butts in seats.
These companies sponsor H1B visas because some of the people they wish to hire happen to not able to work in the US without a visa. They'll hire anyone who passes the interview.
Maybe it's just that they want to recruit good people and some good people just happen to live outside the US?