Why would God create a creation that he knew from the beginning (or before) would be imperfect?

St. Augustine gives a beautifully succinct response to this sin problem:

“Whatever man does, he finds God worthy of praise in His deeds; if he acts rightly, he finds Him worthy of praise for the justice of His rewards; if he sins, he finds Him worthy of praise for the justice of His punishments; if he confesses his sins and returns to an upright manner of life, he finds Him worthy of praise for the mercy of His forgiveness.  Why, then, should God not have made man, even though He foreknew that he would sin, seeing that He was to crown him if he stood firm, make him conform to the divine order if he sinned, and help him if he repented, being Himself at all times and in all places glorious in goodness, justice, and mercy?”  (From De Catechizandis Rudibus 18.30)

How can this be?  It is a matter of the soul’s response to a perfect Creator.  Rather than depend on bodily sensation and emotion for this response, Augustine says that the soul “should retire into itself, away from the senses, and become a child of God again.  This is what it means to become a new man by putting off the old.  To undertake this is absolutely necessary because of the neglect of God’s law:  Sacred Scripture contains no greater truth, none more profound…  (M)y one and only concern might be to render an account of myself to myself, to whom I am above all responsible, and thus to become to God, as Horace says, ‘like a slave who is his master’s friend.’  This is an achievement that is utterly impossible unless we remake ourselves in His image, the image He committed to our care as something most precious and dear, when He gave us to ourselves so constituted that nothing can take precedence to us save He Himself…  (I)t is such as the soul cannot begin or complete except with the help of Him to whom it yields itself.  Hence, it is that man’s reformation is dependent on the mercy of Him to whose goodness and power he owes his formation.”  (From The Greatness of the Soul)

This is not a forced response, nor a response attributed in some way to lapsarian theology.  This is a free will expression.  Augustine clarifies this by stating, “The soul, it is true, has received (from God) free will, and those who try to discredit that by baseless arguments are so blind that they do not even realize that it is by their own free will that they are uttering such inanities and impieties.  Yet, the gift of free will is such that no matter what the soul undertakes with it, it does not disturb any part of the divine order and law.  It is a gift coming from the Lord of all creation, who is wise and whose power cannot be made to yield…  No matter how those in whom He works out His designs may wish to respond, God always attains His purpose with perfect justice, with absolute propriety, and with the greatest beauty.”  (From The Greatness of the Soul)