It matters where the emphasis lands. If it lands on righteous you have the predicament your question highlights. If however the emphasis falls on repentance then the righteous comment takes on a certain understanding.
• Repentance - to change ones mind
This is contrasted to the analogy of a doctor/physician not being needed by the healthy.
Jesus didn’t come to change the mind of those who think correctly, he came to change the minds of those who think incorrectly and incorrect thinking means breaking the law or sinning.
Essentially Jesus is saying that He doesn’t need to help someone who thinks righteous thoughts, He is needed by those who are sinners and need to change their thought process.
“as it is written: “None is righteous, no, not one; no one understands; no one seeks for God. All have turned aside; together they have become worthless; no one does good, not even one.””
Note how none is righteous is followed by no one understands, or no one thinks correctly. This is a matter of repentance or changing the mind to fit God’s way of thinking.
This is a matter of the MIND
““Seek the Lord while he may be found; call upon him while he is near; let the wicked forsake his way, and the unrighteous man his thoughts; let him return to the Lord, that he may have compassion on him, and to our God, for he will abundantly pardon. For my thoughts are not your thoughts, neither are your ways my ways, declares the Lord.”
Notice that God places emphasis on the thought process. The unrighteous man must forsake his THOUGHTS and return (repent) change his mind back to God.
“For as the heavens are higher than the earth, so are my ways higher than your ways and my thoughts than your thoughts.”
To answer your question, who are the righteous? They are those who thinking correctly and have the mind of God/Christ.
To answer your inferred question, were there righteous men who had the mind of God? Yes indeed
“The fear of the Lord is the beginning of knowledge; fools despise wisdom and instruction.”
For the fear of the Lord has to do with the MIND, wisdom and instruction
“Blessed is the one who fears the Lord always, but whoever hardens his heart will fall into calamity.”
As opposed to hardening of the heart
“Who is the man who fears the Lord? Him will he instruct in the way that he should choose.”
Consider that it’s not self righteousness but obedience to God in the fear of the Lord that is counted as righteousness.
““And you, son of man, say to your people, The righteousness of the righteous shall not deliver him when he transgresses, and as for the wickedness of the wicked, he shall not fall by it when he turns from his wickedness, and the righteous shall not be able to live by his righteousness when he sins. Though I say to the righteous that he shall surely live, yet if he trusts in his righteousness and does injustice, none of his righteous deeds shall be remembered, but in his injustice that he has done he shall die. Again, though I say to the wicked, ‘You shall surely die,’ yet if he turns from his sin and does what is just and right, if the wicked restores the pledge, gives back what he has taken by robbery, and walks in the statutes of life, not doing injustice, he shall surely live; he shall not die. None of the sins that he has committed shall be remembered against him. He has done what is just and right; he shall surely live.”