12:18 ‘What is this you’ve done to us?’ מַה־זֹּ֖את עָשִׂ֣יתָ לִּ֑י
20:9 ‘What have you done to us?’ מֶֽה־עָשִׂ֤יתָ לָּ֙נוּ֙
26:10 ‘What is this you have done to us?’ מַה־זֹּ֖את עָשִׂ֣יתָ לָּ֑נוּ
God favours Abraham and Isaac *despite* their behaviour.
If it were just a question of moral performance, I'd put Abimelech here above Abraham.
But, as Paul later notes, people aren't justified in Genesis by their good deeds.
Highlighting God's favour.
In Genesis 20 God twice speaks to the pagan king, not to the patriarch.
In Genesis 26 God speaks to the patriarch immediately before the incident (26:2-5).
The stories aren't pointless repeats
They can be read comparatively
They teach God’s repeated and increasing unmerited grace
They teach the constancy of human error, even by those God specially favours
God has decided to favour Abraham & his offspring & thus to benefit every family on earth (Genesis 12:2-3).
Nothing & no one can stand in the way of that.
Not even the stupidity of God's own people.