I would like to know why God would create the world, when He knew in advance that man would sin and Jesus would have to die. I know that God created the world for a relationship with us, and for His glory. It just seems awfully selfish for Him to create a world in which His own Son would have to suffer and die. Was it God the Son on the cross, or God the Father, too, through the Trinity? I have struggled with this question for so long.
You are correct in your observation that God knew, even prior to creating the world, that man would sin. The Father also planned to send His Son as an atoning sacrifice for the sins of the world. As far as I know, the Bible does not explicitly tell us why God chose to create the world as He did. However, since the Bible does tell us that God is perfectly good and wise, I think we are safe in assuming that God had good and wise reasons for doing things this way. We can only speculate on what those reasons might have been. But ultimately, we have to rest in the morally perfect character of God, trusting in His goodness and wisdom.
However, I believe I would take exception with your statement, “It just seems awfully selfish for Him to create a world in which His own Son would have to suffer and die.” Let me make a few observations and comments about this. First, God the Son was also involved in creation (John 1:1-3; etc.). Second, God the Son was a willing participant in the plan of redemption. The Father and Son do not will different things. They are in perfect agreement with one another. Third, I would argue that this is about the most UNselfish thing the Father could possibly do. The Father loves the Son. What could possibly be selfish about His freely giving His own Son as a redemptive sacrifice for the sins of the world? And the Bible is clear about His motive and reason for doing this. It was love (John 3:16).
Finally, it was God the Son incarnate as the Man Jesus who died on the cross. The Father did NOT die on the cross. Many people in our churches today are quite confused on this issue. One often hears prayers in which the person thanks the Father for dying on the cross. This is incorrect. The Son became incarnate and died for our sins, according to the will of His heavenly Father (which He certainly was in agreement with).
The Lord bless you,