It is illegal for many government employees to express many political views in writing or in public (under certain circumstances), and those laws have been in place for some time. I believe that the stated intent of those laws are to ensure public and political confidence that the bureaucracy will enact the law in a non-partisan way. Whether the laws were a good idea or not, I cannot say, but it seems like government employees should either comply with their legal obligations, campaign for the law to be changed, or quit.
edit: here is a link to the official guidance on the Hatch Act - https://osc.gov/Pages/The-Hatch-Act-Frequently-Asked-Questio...