This section from Genesis Rabbah 14.6 reminds me of Romans 5:12-21:
[Then the Lord God formed] the man: for the sake of Abraham. R. Levi said: It is written, ‘The greatest man among the Anakim’: ‘man’ means Abraham, and why is he called the greatest man? Because he was worthy of being created before Adam, but the Holy One, blessed be he, reasoned: ‘He may sin and there will be none to set it right. Hence I will create Adam first, so that if he sins, Abraham may come and set things right.’ R. Abba b. Kahana said: In general practice, when a man joints a pair of beams [so that they meet] at a slope, where does he place them? Surely in the middle of the chamber, so that they may support the beams in front and behind. Even so, why did the Lord create Abraham in the middle of generations? In order that he might bear the generations before and after him. R. Levi said: You bring a virtuous woman into the house of a corrupt one, but you do not bring a corrupt woman into the house of a virtuous one. 
 H. Freedman and Maurice Simon, Midrash Rabbah: Genesis, V.1 (London: The Socino Press, 1961), 114.