Hypothetically: A person at Apple might not know why they can't hire someone from Google. For all they know it could have been ordered over apple trying to steal Google trade secrets as part of a settlement. Lots of possible reasons why it could be legal. The employee just does not necessarily have the knowledge. So they could make a defense that assumed their employer was acting in good faith.
It's pretty much impossible to prove good faith in the instances of death, and theft. Generally, such things are reserved for governments either through war or (criminal executions) or property seizure. If your employer was the government you may be able to make a good faith defense if it was related to your job and it turns out the government was violating the law.
Also keep mind it's a defense not an immunity. Also the more severe action the harder it is for there to be a lawful reason. There are very few instances were someone could legally kill someone vs not hire someone. It's like orders of magnitude different.
Why aren't those who are tasked with enforcing the law enforcing the law?
Yes it is, see: https://definitions.uslegal.com/c/corporate-immunity/
That said..I agree with the spirit of your post. The only officers that cannot receive corporate immunity are the CEO and CFO - they can be held liable in criminal and civil litigation.