But the second way that I see depravity leading to legalism is more insidious, I think, because it is more subtle and possibly more dangerous. Because we know that we are all depraved, we don't trust each other. You cannot know for certain whether I really feel remorse for sin. You cannot know if I have truly put my faith in Christ. So, in the first part, you might feel it necessary to make a determination about my standing before God by assessing my outward behavior. While I would not say such assessment has no purpose at all, I have seen Christians sincerely desiring righteousness in others and 'purity' in the church (that is, the absence of unbelievers) conscientiously judge another by what can be observed, as if his salvation depended on his own righteousness. I know you've seen it too.
In the second part, my ability to lie and my depraved inclination to it are the valid reasons for your mistrust. Aware that you cannot know my heart, I may believe that I am 'free' to lie with impunity. I may claim salvation that I do not have. Having salvation or not, I may claim remorse I do not feel. Thus, in addition to these sins, I may be complicit in the conspiracy of legalism in order to avoid its judgment.
And, perhaps, therein lies the most grievous irony. You and I can relate to these temptations to legalism because, I suppose, they are shared by us all. But the darkest part of the sin of legalism is its misdirection. While we must most certainly and sincerely fear God's judgment, legalism turns us away from the fear of God from whose wrath we can only be saved by faith in Jesus Christ. Legalism tempts us to fear instead the trifling and fickle judgment of man from which we attempt to escape by pretending to have no need for Jesus.
Do not be afraid of those who kill the body but cannot kill the soul. Rather, be afraid of the One who can destroy both soul and body in hell. ~Matthew 10:28