I think it's because Filoni has to establish in-universe credibility for the idea that Thrawn can restore the Empire in short order and overthrow the New Republic. If he's supposed to present a threat worthy of a crossover movie event, that sort of galactic consequence needs to have a foundation set up first. Can't do that without planting seeds that there are people at the highest levels of the NR who are corrupt and working to undermine anyone who would potentially help keep Thrawn from taking over.
Trying to court martial Hera would be in an effort to not only take her (a capable and proven combat veteran) off the board, but would send a message to others letting them know not to go digging into this Thrawn "nonsense." Of course, this is pretty much undermined completely by having the idea of court martial undone so easily, but I think that's the ultimate narrative purpose of this subplot.
And since we know that Thrawn will eventually be defeated anyway, this also establishes why a Resistance was needed and how a First Order would be capable of stepping into the void left by Thrawn's attempted coup. I know ST detractors want no part of that, but I think it's an eventual certainty where all roads lead.