I get the feeling that the programmers who are finding it difficult to find work at the moment are those with mediocre skills
Well, enjoy that feeling. It's worth every penny you paid for it.
As for Musk, he's a big corporate player. Calling him a "programmer" these days is pretty silly. Using him to justify outsourcing basically the majority of programming jobs is also pretty silly.
Note that my employer isn't farming out jobs to foreigners because they're trying to cut costs, but because it is genuinely difficult to find the skills
Yes, it does become difficult if "too old, too unhealthy, no degree, overqualified, wrong state, bad credit" are used as stacked pre-filters. But to argue that unemployed programmers in the US are "mediocre" isn't just silly, it's ridiculous.