The h1b issue is caused by short sightedness by management and by complacency by employees.
I can't be replaced by an h1b because it takes 3-4 of them to do my work. I'm what is known as a "purple squirrel". My wife likewise. Plus we have enough common sense to detect outsourcing and act accordingly if needed (her, not me).
Now, I don't expect the average common mortal to go and get a PhD to avoid being outsourced, but it takes some effort to learn new things and stay current. In engineering, it's expected and generally done. In IT... not so much.
Or, if you end up in a small town with few options, because you love the rural lifestyle, well, tough luck...
Having said that, the current crop of h1bs is generally awful. Nothing like the top people from decades ago. And I hope Trump does something about it, but will believe it when I see it.
All it takes is your company to be bought out and even the indispensable people end up going. I am the same as you, basically the go to guy for all things tech, and it happened to me when my old company got bought out. Now that doesn't have to do with h1b but same concept. No one is irreplaceable, everyone has to learn this the hard way though.