How was humankind's disobedience not part of his plan?
He would know the future.
God can choose to know whatever he likes. But let me ask you this: "if you were a master locksmith and you made a key that could unlock every lock in existence, would you have to unlock every lock just because you could? "
God allows humans to exercise their own free will. He did not pre-determine the outcome of the the scenario in Eden, but allowed the humans and the devil to make their own choices.
There were a few different outcomes that could have equally played out.
1) The woman could have rebuffed the devil's offer citing God's command and obeying it, despite the temptation that was offered. There is one rebel.
2) The woman may have eaten the fruit, but her offer to her husband could have been refused because the man was better educated and have chosen loyalty to his God, rather than to his wife. There are two rebels.
3) The devil tempts the woman who in turn leads the man into sin. There are three rebels.
Number 3 is the worst case scenario, but was used then to implement an object lesson for the whole human race, as well as a good test for God's angelic sons. All have free will and all will be separated into two groups at the end of the lesson.
Jesus mentions the fate of the devil along with all who fail the test of loyalty....
Matthew 25:31, 41:
“When the Son of man comes in his glory, and all the angels with him, then he will sit down on his glorious throne. 32 All the nations will be gathered before him, and he will separate people one from another, just as a shepherd separates the sheep from the goats. 33 And he will put the sheep on his right hand, but the goats on his left......
“Then he will say to those on his left: ‘Go away from me, you who have been cursed, into the everlasting fire prepared for the Devil and his angels."
So the writing has been on the wall since the beginning. Unless you understand what life in this world is all about, you can miss the lesson completely and see God as some kind of failure for not preventing the trauma and tragedy that has resulted from the bad choices made in Eden. This was all planned so that it will set precedents for all eternity to come......rebellion will never again be permitted to disrupt God's eternal purpose.
Any who abuse free will in the future will be dealt with swiftly.
Don't forget that time is only relevant to those who have a limited supply of it. God has no such restriction, so he can allow as much time as is necessary to set those precedents. All humanity then receives the same test, with the same choices. Angels too will have made their decision to either serve their God faithfully or join the devil in opposing him. There are only two camps.....those who are for God and those who are against him.....we are free to choose the camp.