The same works for God and the nature of evil. If God knows everything that will happen if he makes the universe doing this and that, then he also knows that evil will happen, should he be held responsible for the evil of the world in that case?
Or, rather can a perfect creation do anything other than what is right ?
God did not create angels or humans as robots or automatons.
Perfect creation was created as free moral agents or with moral freedom.
Satan did Not stand fast in God's truth.-John 8v44
As Adam although created perfect had physical limits [can't eat gravel and not suffer] So, too Satan was created with relative perfection.
Not absolute perfection. Going beyond God's boundaries exposed himself to ill effects. Misuse of free will caused himself to fall from perfection into imperfection.
Where does it say in Scripture that God knows everything ?
We do know that God says there will be a happy outcome, or happy climax to Revelation because Jesus will usher in global peace on earth starting with his 1000-year reign over earth.
But, if God were omniscient there would have been no need for God to intervene on Noah's behalf at the time of the Flood.
The Adam and Eve scenario would not have taken place.
And if foreknown why wait until one is dead to pass judgment ?
At Rev. [7v9] the people are un-numbered.
If all knowing then it would be a set or sealed number.
If God would have wiped out Adam and Eve before having children we would not be here. God's purpose [Gen 1v28] was that the descendants of Adam and Eve [us] populate the earth. So before God's takes action we needed to be born and decide whose rule do we think is best?