Jon Levenson in The Death and Life of the Beloved Son uses two Hebrew Bible stories to illustrate the theme of the non-literal sacrifice of beloved children. One of them is the story of Solomon’s birth to David and Bathsheba. Solomon’s brother, the love-child of the pair had died. David apparently understood that death as an atonement for his adultery and murder.
In 2 Samuel 12:24-25 we learn that Bathsheba named him Solomon. One way of understanding the name Solomon is that it meant “his replacement” or “the one who makes whole.” I can understand Bathsheba seeing Solomon as a consolation for the child who had died. She later engineered the coup that made her queen mother and Solomon king. She may already have thought of him as heir to the throne and rival of David’s other children. People probably saw Bathsheba as just a concubine and not one of the royal wives. (Levenson only talks about the name of Solomon. Trying to get into Bathsheba’s mind is my commentary. Speculating about 1st and 2nd Samuel is a hobby of mine.)
In the same passage we learn that God, through the prophet Nathan, named him Jedidiah. This is close to the name Yadid. Basically it is the yahwistic (my software keeps changing yahwistic to atheistic) name, yadid-ya. Levenson tells about a Phoenician myth in which the god El had been a mortal king before he was deified. He had an only son named Yadid. When an invasion threatened the kingdom, El arrayed Yadid in the clothing of a king and sacrificed him on an altar. Of course, El became a Hebrew name for God and got embedded in names like Beth-el and Samu-el.
When Philo of Byblos recounts the myth of El and Yadid, he says that the Phoenicians still use this word for “the only begotten”. But, in fact, the word for “only begotten” seems to be yahid, not yadid. So Philo assumes a connection based on the fact that the names sound alike. Levenson seems to think there is a real connection to the Phoenician myth. Yadid is a rare Hebrew word meaning beloved or precious. He carries it through the story of Abraham’s only begotten son, Isaac, all the way to “God so loved the world that he gave his only begotten son” in John 3:16.
With Solomon, though, it seems to mean that even though David and Bathsheba had an earlier son, now Solomon becomes their only and precious son.
The other story is that of Jacob and Joseph in the last chapters of Genesis. Jacob had other and earlier children, but Joseph was his son by Rachel, the wife he loved. So Joseph was the beloved son. Yet Jacob, even knowing that the brothers hated Joseph, sent him to them and made him vulnerable. Joseph ended up a slave in Egypt. But for all Jacob knew, he was dead. This accounts for Rachel weeping for her children who are gone (Jeremiah 31:15).
Rachel’s other son, Benjamin, becomes, like Solomon, a replacement. Deuteronomy 33:12 calls Benjamin the beloved (yadid) of the LORD.
All of this is leading up the idea of Israel as the beloved son of God. This is not so comforting an idea when you realize that, according the background myth, God (El) sacrificed his only son. But the Hebrew Bible is also strongly supports the idea that a father can redeem his son.