So there are only two times in Les Mis when Javert dares to criticize his “superiors,” and both times he’s instantly mocked/condemned for being insane. (even though both times he’s actually right!!!)
The first time is when he denounces Mayor Madeleine for being Valjean:
“….I denounced you at the Prefecture.” (said Javert.)
M. Madeleine, who had taken up the docket again several moments before this, resumed with an air of perfect indifference:—
“And what reply did you receive?”
“It is lucky that you recognize the fact.”
The second time is over his suicide note. His suicide note is just a carefully-written list of criticisms he has of the police force, and small reforms he wants to see, written in a perfectly sane level-headed way.
But after he kills himself, his obituary says only that:
Javert had been found drowned under a boat belonging to some laundresses, between the Pont au Change and the Pont-Neuf, and that a writing left by this man, otherwise irreproachable and highly esteemed by his superiors, pointed to a fit of mental aberration and a suicide.
“Javert’s superiors said that their inferior was a very Good Dog, very well-behaved. Except for that one mean letter he wrote critiquing his superiors! But he didn’t *really* mean that, he just had some random crazy fit >:(”
I also think there’s Foreshadowing in how….in the scene where Javert was talking to Valjean/Madeleine, Javert says he accepted he was mad for daring to denounce his superior, and Valjean responded “it is lucky that you recognize the fact.”
And when Valjean reads about Javert’s “fit of mental aberration” he takes it at face value.
“In fact,” thought Jean Valjean, “since he left me at liberty, once having got me in his power, he must have been already mad.”
Valjean is like: “oh, of course. Javert didn’t let me go because he thought I was a good person! He let me go because he randomly went crazy.”
Javert spent his last hours thinking about Valjean as someone who “kneels on the heights of virtue, more nearly akin to an angel than a man.”
And Valjean’s just like “No one who knew all the gory details of my past, the way Javert did, could ever think I was a good person. So Javert can’t have thought I was a good person. The only explanation for why Javert let me go is that he randomly went crazy”
In the few moments where Javert does break his programming and stop blindly obeying authority, he’s instantly labelled as crazy by everyone and it’s just…AHHHHHHHHHHHHHHHHHHHHH