By resigning you take the initiative, control the timing, and can put out a statement of what the problem is. If you don't resign and refuse to play along with unethical/illegal directives, you get fired and unethical people who issued the directives tell a story about how you're a saboteur or something. Whoever gets their story out first is likely to set the tone for subsequent public debate.
You might be overestiamting how much 'clout and power' people in public life have. Few of them are known outside of their specialty field, so they really don't have much clout. And their power is quite limited; you may have noticed that multiple inspector generals (who are legally independent of the executive branch) were fired early in the administration. Several of them went to court and have obtained judgments that their firings were illegal, but the damage is already done.
You might be overestiamting how much 'clout and power' people in public life have. Few of them are known outside of their specialty field, so they really don't have much clout. And their power is quite limited; you may have noticed that multiple inspector generals (who are legally independent of the executive branch) were fired early in the administration. Several of them went to court and have obtained judgments that their firings were illegal, but the damage is already done.