Ignorance of the law is never a defense; either intentionally or not, the company has followed a discriminatory policy in hiring. Refugees and asylum seekers with work permits are of the same status as US citizens, with Elon Musk seemingly promoting a top-down approach where this isn't the case. At best, this was another one of Musk's blunders and, at worst, an act of blatant and illegal xenophobia.
This is not the first time the DOJ has launched a nonsensical crusade against Elon Musk and SpaceX. The company is simply practicing due diligence by ensuring foreign nationals don't have access to America's sensitive aeronautical industries. The government has a bone to pick with Musk, with the last hiring case imposing obscene and farcical burdens on the company for no apparent reason.