The real question is, would a perfect Being create an imperfect creation? While I don't proffer any, I think there are valid reasons to do so.
The Christian gnostics reasoned it must have been either a lesser evil god or blind fool who created the material world.