He could’ve created a universe without sin, but then there could be no love and ultimately no free will or choice to obey or disobey God. Evil was once good and is a perversion, distortion, or parasite of good. When God did create everything, He did say, “It was very good.” But God couldn’t grant us free will or choice and then prevent us from using them to disobey or hate Him. Love and obedience must be voluntary and a choice. So God inevitably created the possibility of evil.
As far as the fact that everything cannot be perfect, that is hard to define since perfection involves immutability and eternity (it cannot improve or need improvement, nor change for the worse). Note that this world is only a staging area for eternity and heaven will be perfect, and no sinners will be there or it would no longer be perfect. This world is temporary and a test or trial for the next. Even hell will be perfect: perfect justice.
What’s more, nature is always in a state of flux! You never step into the same river twice! Only God cannot change and is immutable and unchangeable in nature or attributes. Jesus is the same, yesterday, today, and tomorrow! We will always be in need of improvement and always on a learning curve. God’s knowledge is perfect—past, present, future—all things logical and possible. We are confined and limited to the time-space continuum but God is immaterial and spirit.
Only God can be perfect and He could not create another God and creation by definition isn’t perfect because it was created and perfection implies being uncreated or eternal without beginning,. But there can only be one Supreme Being who is Almighty in the same reality or cosmos. The closest we see to perfection in this life is Jesus because He is the Son of God and without human flaw—-sinless,