You've got your Javert-Ćponine parallels and your Javert-Valjean parallels; now get ready for Javert-Marius parallels!
Both of them are faced with Valjean's dual identities, but the reveals are flipped: Javert, introduced to Valjean as a convict first, is shocked by his kindness. Marius, who only knew him as simply Cosette's kindly father, is horrified by his criminal past. Despite these inverse reveals, however, both have similar reactions: they refuse to accept the fact that ideals and/or people can be comprised of contrasting, contradicting parts.
With Javert, being saved by Valjean spurs him on to realise that the law is not always right, and that convicts are not all horrid; his beliefs can no longer be as black-and-white as they were. In another universe, this realisation would have started Javert on a different path of life but instead, he refuses to accept this, leading to his death.
With Marius, much of his inability to understand that such complexities exist comes when comparing Valjean to Cosette. He acknowledges that:
Jean Valjean had labored over Cosette. He had, to some extent, made that soul. [...] The workman was horrible; but the work was admirable.
Marius knows that, in some aspects at the very least, his perfect Cosette was shaped by this "horrible" workman. But these conflicting descriptions continue to perplex him:
What melancholy sport of Providence was that which had placed that child in contact with that man? Are there then chains for two which are forged on high? and does God take pleasure in coupling the angel with the demon? So a crime and an innocence can be room-mates in the mysterious galleys of wretchedness?
He cannot understand why and how Valjean ā a supposedly dangerous felon ā could be bonded with the pure and innocent Cosette. Outside of Cosette, even, Marius still cannot comprehend the fact that innocence and crime can coexist within the same space, the same household, the same body. Valjean himself is a host of crime and kindness, and Marius cannot understand how that can be so.
And because he cannot understand how, he refuses to accept that Valjean could possibly be more complex than he realises:
He sought to dull his senses rather than to gain further light. [...] he bore off Cosette in his arms and shut his eyes to Jean Valjean.
Like Javert, Marius thinks One Thought and then immediately refuses to expand upon it and simply doubles down on his fear. Here is where Hugo's biasedness for Marius can be seen though as we are told that:
He had not yet accomplished all progress, we admit. He had not yet come to distinguish between that which is written by man and that which is written by God, between law and right. [...] He still stood at this point, though safe to advance infallibly later on, since his nature was good, and, at bottom, wholly formed of latent progress.
The last line hints that Marius will eventually break away Javert's similar line of thinking since "his nature was good" (which then begs the question, is Javert's nature then simply just unable to eventually accept this change in thinking? Is his nature "bad"?). A relief, I suppose, but it doesn't help the fact that right now, his prejudice continues to lead his thinking and behaviour, blinding him to the reality of society that he had but a glimpse at.
All in all, Javert and Marius were both so close to getting it. But Javert would rather die than accept it, and Marius would rather let Valjean die than accept it as well. Such a frustrating and tragic pair.