There is a view called Middle Knowledge. God knows all of the options and how man will decide but allows us to decide as we do. But He turns the outcomes toward the good of His plan. But He makes us all to love Him. Not to sin.
God did not want man to sin, He was aware of what would happen, not because He made it happen..but because He can see all time and space. People have free will because love not freely chosen is not love.
But God will turn all things to good, by using the free willed choices others make toward Him and good to fulfill His plan. But He forces no choice on anyone. God made man, not intending for sin to happen or making it so...but He allowed people to have the free will to choose to turn away. Which is essentially sin.
God could will we were born with grace...and when we lose it again through sin...like every single one of us would? What then. Continual discord. Only Christ fixes it, makes it anew.
Even though God could have simply fixed things; make us born with grace...the dogmas and theology as laid out shows how the wound in our relationship was lovingly "repaired and reknit" and healed. All the parts of the fall were Redeemed and rewoven. I find it all amazingly beautiful. It was not magic, it was the miraculously beautiful effort of God reaching out to us and allowing humans to play a part as much as they could. God did not wave His hands and make it all better. He made them human and got them dirty, toiled and bloody as an example to show us how to live and fix things in our own relationships. That it takes effort.
Fulton Sheen said:
What concerns us now is the restoration of these gifts through another act of freedom. God could have restored man to himself by simply forgiving man's sin, but then there would have been mercy without justice. The problem confronting man was something like that which confronts an orchestra leader.
The score is written and given to an excellent director. The musicians, well skilled in their art, are free to follow the director or to rebel against him. Suppose that one of the musicians decides to hit a wrong note. The director might do either of two things:
either he might ignore the mistake, or he might strike his baton and order the measure to be replayed. It would make little difference, for that note has already gone winging into space, and since time cannot be reversed, the discord goes on and on through the universe, even to the end of time. Is there any possible way by which this voluntary disharmony can be stopped? Certainly not by anyone in time.
It could be corrected on condition that someone would reach out from eternity, would seize that note in time and arrest it in its mad flight. But would it still not be a discord? No, it could be made the first note in a new symphony and thus be made harmonious!
A symphony starting over and over with discord after discord or one where original sin is the first note because the great Redeemer we have. God did not make us for sin, but it was freely chosen. But from that...an amazing good He brings.
So God does not intend sin, but He works around it all. The purpose of Adam and Eve was never to commit sin. They were made to love God, not to sin. If they were made to sin, then they were not made to love God. And since we know they were made to love God, because it is the reason we all are made...then their purpose was not sin. In fact the Church is clear that their purpose was not sin and they were not made for that.
God was not surprised but He did not make them to mindlessly carry out a role that was counter to His own being. He decided to make them in His image because He loved them and made them for relationship with Him. He knew, because of middle knowledge, what they would do. But He did not decide to make them for that...but He knew what they would do. That is different from making them to do it. He made them able to choose Him, but they did not. They freely could have and had an equal chance to do so.
They were made for love and relationship with God. They chose self and no relationship with Him. He then reached out to redeem.
But they were not made to sin. Or to carry out the role of sin.
Adam and Eve had the same chance to accept God's will that the new Eve...Mary did. They chose wrong. She chose right. Her choice was free as well...or it would be meaningless.
Mary could have said no. She did not, God knew what she would do...and He made her for relationship and she chose relationship. But the first parents were made for relationship and chose self. They were not made for self and sin.