The two stories within our passage are linked by a common factor: the judge's contempt for justice, & the contempt in which the Pharisee holds the customs collector. While Jesus uses the woman's approaches to the judge to teach us to pray with persistence, God & the unjust judge have nothing in common. Any more than the Pharisee & the customs man do, apart from their humanity. We often teach by comparing, but here by contrasting.
A word of caution about the first little story: let's not batter so much on God's door that we don't hear God's gentle knocking on our own! The Orthodox insistence on the life of inner prayer is a useful counter to any let's bash God's door down approach we may be tempted to take, or encourage others to! And a caution, too, about the second: that we not become like the famous Sunday school teacher who ended a lesson on the two men with a prayer "that we may not be like that Pharisee"!
I was startled - & I mean startled - many years ago to come across a poem by Peguy (The Mystery of the Holy Innocents) in which the 'Our Father...' is likened to a line of battleships attacking God, with Jesus hands joined in prayer as a battering ram. The imagery is powerful, but I still can't come to terms with it, certainly not in isolation; any more than the suggestion at least implied by some preachers that Jesus is teaching us to wear God down as the woman wears down the unjust judge. That's not Jesus' point, & it does no justice to God.
One of the mysteries of faith is that if, as Jesus says, God 'grants justice to his chosen ones who cry to him day & night' why isn't that a lot more obvious? 'Thinking' Christians have the same dilemma thinking Jews had during & after the Holocaust. It's a paradox we must live with, even if one solution, justice in the next life, doesn't seem as attractive or compelling as justice now would be!
We don't need to stand on the steps of our churches to be like the Pharisee of the second story, nor to stand afar off as the customs agent does. Wherever we are, our inner geography that's driving us is what matters. To go back to the Orthodox for a moment, I can't think of a better tool for both persistence in prayer & the humility of seeing myself as I am than that ancient prayer of the Eastern Church, the Jesus Prayer: "Lord Jesus Christ, have mercy on me (a sinner)". Especially as I suspect it's derived from our second story.