It’s not illegal, but most government employees work for the executive branch, so you can theoretically be fired for not obeying the chief executive (president). Just like someone at a company can be fired for disobeying the CEO, unless there is actually a law protecting the specific behavior.
Musk wants to block it, so being against blocking it is the opposite of what he wants.