I'm no fan of Musk, not by a long shot. Working in the aerospace industry, the vast majority of us have an extreme dislike of the guy, especially for stealing credit.
But what SpaceX does for hiring is correct. This wasn't them arbitrarily deciding things, pretty much every aerospace company that does work with ITAR or EAR material gets told that American citizenship is required if the person will be anywhere near that kind of material. Even if your job function isn't related, if there's a chance you can see it you need to be able to legally do so.
Seems strange for the DoJ to go after just SpaceX in this one since I know LHM, Boeing, NG, Raytheon, etc, if you're in a facility that has ITAR/EAR stuff you need to be a citizen.