Jesus did not speak only for the time of the old covenant. He said His words will not pass away, and even at the last day His words will judge (Matthew 24:35; John 12:48). The Spirit of truth does not cancel what Jesus said, but reminds us of His words and teaches us to live them (John 14:26).
When you ask if a person can be righteous before God without obeying the Ten Commandments, I will answer with what Jesus Himself said. He did not come to destroy the Law but to fulfill it, and He said not one part would pass away until all is fulfilled (Matthew 5:17–18). He also said clearly that if we want to enter into life, we must keep the commandments (Matthew 19:17) and "Blessed are they that do his commandments, that they may have right to the tree of life, and may enter in through the gates into the city." (Revelations 22:14) , the last verse are the words of Jesus ans was written between 70-95 AD. this shows that the message of Jesus did not change.
Yes, you are right that sin is not only in action but also in the heart. Jesus said even to look with lust is adultery, and to hate in the heart is murder (Matthew 5:21–28). This shows us how deeply we need God’s mercy, but it does not remove the call to obey. Abraham was counted righteous because he believed and obeyed God’s voice (Genesis 22:18).
So the truth is this: no one can claim righteousness while willfully disobeying God. We are called to repent, to seek forgiveness, and to walk in His will. That is why Jesus said, “Not everyone who says to Me, ‘Lord, Lord,’ shall enter the kingdom of heaven, but he who does the will of My Father” (Matthew 7:21).