Yes, Abraham learned by his mistakes as did all those God considered Righteous. That's what children do, they learn by their mistakes, they learn from falling. It's part of life. But you ignore God's Words regarding Abraham.
Gen. 26:
4 And I will make thy seed to multiply as the stars of heaven, and will give unto thy seed all these countries; and in thy seed shall all the nations of the earth be blessed;
5 Because that Abraham
obeyed my voice, and
kept my charge,
my commandments,
my statutes, and
my laws.
Abraham was considered righteous "BECAUSE" he followed God's Instructions, not because he rejected them as Uzzah did. You accuse Abraham of "many" sins after he turned to God in obedience. God, however, does not condemn him. But Cain God did condemn, Ham, God did condemn, Uzzah God did condemn. Like DJ said, it was because Abraham and Rehab trusted God enough to listen and follow His instructions that they were considered different than Uzzah and Ham who did not. Like Jesus said:
John 14:
23 Jesus answered and said unto him,
If a man love me, he will keep
my words: and my Father will love him, and we will come unto him,
and make our abode with him.
24 He that loveth me not keepeth not my sayings:
and the word which ye hear is not mine,
but the Father's which sent me.
No one is saying they can forgive their own sins EG. I don't know why you keep implying this. But there is a difference between the "works" of Abraham and Rehab, and the "works" of Ham and Uzzah. And the difference is discerned by their choices, their "works". One trusted God enough to listen and follow His instructions, and one didn't. How can you deny this?