On Galatians 3-4, the ESV Study Bible comments:
3:6-9 The Gospel in the OT (1): Abraham. Paul issues a second direct appeal to the Galatians: it is not just their own experience of receiving the gospel by faith that should teach them that salvation is not by the law by grace. Rather, the OT example of Abraham also teaches that it is through genuine faith, not the law, that one is counted righteous (see Gen. 15:6).
3:10-14 The Gospel in the OT (2): Leviticus, Deuteronomy, and Habakkuk. Any attempt to be justified by the law leads to a curse, for righteousness comes only by faith in the atoning work of Jesus Christ. All those indwelt by the Holy Spirit enjoy the blessing of Abraham.
4:21-31 The Gospel in the OT (3): Abraham Sons. Paul continues to emphasize the chasm between being a free child of God and being a slave to the law, sin, and false gods. The background to this passage is Genesis 16-17 and 21. Abraham’s son Ishmael–technically the firstborn–represents the slave sons of Abraham and hence the enslaving Sinai covenant, because he was Abraham’s son through the slave woman Hagar. Isaac, on the other hand, represents the free sons of Abraham (see Gal. 3:7, 29).