It's no coincidence that one of the main characters in The Count of Monte Cristo is a prosecutor. Dumas wants to see you thinking long and hard about justice and judgment, whether it be human or divine, swift or lingering, inside court or out in the world. Villefort may be a lawyer, but he doesn't have a monopoly on justice. Far from it. Time and time again, we see that justice is a slippery thing; even the most righteous characters find themselves wondering if they're on the right side of the line between moral and immoral, good and evil.
Although most every formal legal proceeding in The Count of Monte Cristo is tainted by corruption, Dumas makes it clear that the legal principles underpinning the law are sound; it is only the people in charge of observing them who have been compromised.
Given the tumultuous times and his equally tumultuous past, Edmond's quest for personal justice is understandable; only by taking matters into his own hands can he settle himself and his scores.