Backdooring his employer's code would be directly related to his work, and illegal actions on his own time would make him unemployable if caught and convicted, because he'd go to prison. False equivalances, all.
There is a limited prohibition against screening for political affiliations enforced by the Federal government when filling certain civil service positions, but that's about it.
For a good summary of what types of discrimination can and cannot trigger legal liability, see here: