God does not give saving grace because of good works. Romans 9:10-13
Jacob and Esau were equals in the womb, and in order of birth, Esau had priority. According to ancient social custom, Esau should have inherited everything. But God by his grace turned everything backward. God had already decided that Esau would be below Jacob, and Esau's people would serve Jacob's people. God had fixed a distinct special love and blessing onto sinful Jacob, and had rejected sinful Esau. God announced this to Rebekah when neither boy had committed any sinful or righteous acts, since they were unborn babies. God was committed that his plan should stand firm. It couldn't be conditional on morality – what if Jacob ever sinned? What if Esau ever did a good act? That would derail God's purpose. So God gave his grace-gift to Jacob unconditionally, one-sidedly, so that nothing could shake the plan. Was this unfair? Fairness had nothing to do with it. God's gift is always free.