Who was the son whom Abraham was told to slaughter?

The Jews have always claimed that the command which Abraham received to slaughter his son was connected to Isaac and not Ishmael.

However, both the Quran and the Torah indicate that the son was in fact Ishmael and not Isaac.

In the Quran:

We read the following sequence of events:

[37:100] My Lord, grant me of the righteous ones."
[37:101] So We gave him the good news of a forbearing boy.
[37:102] Then when he was old enough to accompany him, he said, "O my son, I see in a dream that I am slaughtering you, so see what you think." He said, "O my father, do as you are commanded to do. You will find me, God willing, of the patient ones."
[37:103] Then when they both submitted and he placed his forehead on the ground.
[37:104] We called him, "O Abraham,
[37:105] you have believed the vision!" Indeed, We thus reward the good doers.
[37:106] This was a clear test indeed.
[37:107] We made a concession for him in place of a grave slaughter.
[37:108] And We preserved his history for those who followed.
[37:109] Peace be upon Abraham.
[37:110] We thus reward the good doers.
[37:111] He was one of Our believing servants.
[37:112] And We gave him the good news of Isaac, a prophet from among the righteous.

The narration above tells us that God gave Abraham news of a
forbearing boy (37:101), after which the event of the dream and the intended slaughter occurred. Then after God saved Abraham from slaughtering his son, God gave Abraham news about the coming of Isaac
The sequence in this narration indicates that Isaac came after Abraham was given news of a forbearing boy and after Abraham saw the dream. This can only mean that the forbearing boy was Ishmael.

In the Torah:

It is interesting to note that the Jews who insist that the son for the slaughter was Isaac, have sufficient indications in their own Book that it was Ishmael and not Isaac!

1- Abraham was 86 years when Ishmael was born (Genesis 16:16)

2- Abraham was 100 years old when Isaac was born (Genesis 21:5)

3- Therefore, Ishmael was 14 years older than Isaac.

4- We read that God commanded Abraham to sacrifice his "only son" (Genesis 22:2). Isaac was never an "only son", but for 14 years, Ishmael was the only son of Abraham.

5- To counteract this argument, the Jews manipulated the "only son" issue by claiming that Ishmael was an illegitimate son! They add that since Ishmael was an illegitimate son, then Isaac was the "only son".

6- Why did the Jews attempt to discredit Ishmael? Is it because prophet Muhammad and the Arabs are the seed of Ishmael and the Jews brand Muhammad a false prophet?

7- However, whoever attempts to corrupt God's truth will always fall flat on his face! In their blunder, they totally overlooked the fact that God acknowledged Ishmael to be the seed of Abraham and promised a great nation out of him.
I will make the son (Ishmael) of the slave woman into a nation also, because he is your own seed. (Genesis 21:13)

8- In response, they claim that Ishmael was indeed the seed of Abraham, but he was an illegitimate son because Hagar was not a legitimate wife of Abraham!

9- Once again their claim is refuted in their own Book. In Genesis 16:3 we read how Hagar was given to Abraham as a wife. How can the son of his own wife be illegitimate?

And Sarai Abram's wife took Hagar her maid the Egyptian, after Abram had dwelt ten years in the land
of Canaan, and gave her to her husband Abram to be his wife.
(Genesis 16:3)

We also read in the Torah that Ishmael was given his name by God:

And the angel of the LORD said to her, "Behold, you are pregnant and shall bear a son. You shall call his name Ishmael, because the LORD has listened to your affliction."
(Genesis 16:11)

If we put the above evidence together, it becomes clear that Ishmael was the seed of Abraham, he was named by God and he was from the legitimate wife Hagar, how can Ishmael still be called illegitimate?