From Milton Terry’s discussion of the Hagar and Sarah allegory in Gal. 4:21-31, from his Biblical Hermeneutics, pg. 323:
Herein especially consists the great difference between Paul’s example and that of nearly all the allegorists. He concedes and assumes the historical truthfulness of the Old Testament narrative, but makes an allegorical use of it for a special and exceptional purpose.
In other words, Paul is applying the Genesis narrative, not exegeting it.