It may be technically illegal, but according to the article he did the same thing during his first term. I don’t believe anything happened then in response so it’s unlikely anything will happen now.
“
Trump ousted five watchdogs in quick succession during his first term in 2020, starting with Michael Atkinson, the intelligence community inspector general who alerted Congress to the whistleblower complaint that led to Trump’s first impeachment. Trump had appointed Atkinson. The president also removed the State Department’s chief watchdog, who had begun investigating alleged misconduct by then-Secretary of State Mike Pompeo.”