God’s scheme was clear from day one even before creation of Adam (AS). It was clear from the moment God revealed His plan in front of Angels to create Khalifa in this world i.e. a creation that’ll be given both freewill and kingdom of this world. The misuse of the freewill itself emanated from this concept as expressed by Angels in their concern as well i.e. that this creation will the create anarchy and destruction (fasad) because of misuse of the same freewill and unrestricted power given to human beings.
The incident of Satan was a reflection of one extreme of the same freewill when misused under arrogance. Since it represents one extreme of a deed i.e. istakbaar, after which a person loses his/her right to be part of God’s eternal kingdom, that is why it became a symbol of disobedience and we were warned to not follow the same footsteps so as to deprive ourselves of God’s mercy permanently. All of this emanates from the creation of human beings and fits perfectly within overall scheme of God in this world.