Do we insist on having hostile discussions based on metaphors? That is what so many of these biblical concepts have to be. If God is light and in him is no darkness at all, then if we were talking physics, he could never be made out. You can see objects that are very bright, but if not for darkness, per se, you could never identify them. You know a bright light bulb when you see one, but if everything surroundng it were either just as bright, or the bulb itself were so bright it washed out any outline or background of anything else, you wouldn't know it was a light bulb. [To try to not bring another sub-debate into this, seeing God is a continuing paradox in scripture that is not the main point here.]
So if He created all things, but some of the things are contrary to His character-- a definition of sin-- then must we presume He ordained every sin that anyone could ever commit, with the sinner having absolutely no choice otherwise? No, I don't think so. He is all light, but His character is seen in persons and acts which are not all light.
If the real question is "Why?" not "Whether?" most likely we will have to be closer to perfection to know-- if we ever do know. But using another metaphor here, most young couples do still want to have children. Maybe they want perfect children, but they are completely delusional if they really think their children will be perfect. But they still want them, so they still have them (if possible). If it's worth it to have children who will choose to love you and try to please you, knowing that some will please you more than others, some might turn against you, and none will be absolutely perfect, you still want them to to choose to love you. Light has no value if there is no darkness whatsoever, but it does represent superiority. And love wouldn't have value if there were nothing less than love. Machines do what we want if we flip the right switch, but they don't love us, and they have no choice what to do. God opted for children who would choose to love him, so the possibility of doing less was an option.; therefore he created humans, not robots.
Alexander Graham Bell didn't "cause" obscene phone calls or unwanted solicitations, but his development did lead to their possibility. And with the light bulb, what did Tom Edison invent?-- light or darkness? Not either literally, but a safer, more efficient way to see in the darkness, which is the absence of light. But in that absence, someone in the darkness can see us that we can't see if it light doesn't shine on them. With these consequences, why did we (mankind) invent anything if there are always negative possibilities? But Bell isn't thought of the cause of obscene calls, or Edison the one who made us targets for dark-clad hooligans. With God, we can't choose but think he had to create the negative possibilities along with the good desirable goals, and to know evil will be a consequence. If there is/was some way He could have given us a true choice to love Him, and everyone would-- that's just beyond our comprehension. And if He had created perfect comprehension for us, ... (where do these kind of questions stop?)