This choice by God was made before either child had been born, not based upon whether either had done any good or evil, to show that he elects whom he will, not influenced by their works.
Most on this forum thinks God makes his choice on whom he will deliver eternally, by their believing, accepting, confessing, being baptised, repenting, etc. which is far from the truth of the scriptures.
As much as we have passages that discuss being chosen or having a name in the book of life since the foundation of the world:
"According as he hath chosen us in him before the foundation of the world, that we should be holy and without blame before him in love:" - Eph 1:4 KJV
"...whose names were not written in the book of life from the foundation of the world..." - from Rev 17:8 KJV
We also have references to the concept that one may have their named blotted out from the book of life in the same way that the handwriting of the ordinances of the law were blotted out.
"Let them be blotted out of the book of the living, and not be written with the righteous." - Psalm 69:28 KJV
And this suggests that a status established from the beginning of time can be changed (in reaction to choice, otherwise why would their name be in the book of life to begin with?). There are different ways to look at it.
We can look at things through the lens of hard determinism or soft determinism. It doesn't really change anything. If you believe in hard determinism, it's not that "choice" doesn't exist in any capacity, it merely becomes an observation of the perception that something could have been different as a way of abstractly conceptualizing cause and effect. The relationship between cause and effect remains the same. Esau lost his OT promise inheritance in a causal relationship to that which we percieve to be his choice. Whether the choice was real or not doesn't matter. And that single passage alone doesn't address whether he was ultimately saved or unsaved. God will show mercy to those He will show mercy.
to show that he elects whom he will, not influenced by their works.
Many are called, few are chosen. I see work and choice as two different things.
If choice has no bearing on salvation, why would Deuteronomy reference choice?
"I call heaven and earth to record this day against you, that I have set before you life and death, blessing and cursing: therefore choose life, that both thou and thy seed may live:" - Deut 30:19 KJV
I'm not claiming that determinism would necessarily be incoherent. I'm just suggesting that there are other valid ways to look at it.