Yes, of course He knew. He also knew you would ask that question. :)
Why didn't He stop it, if it is so horrible?
For the same reason He didn't stop Adam from disobeying Him in the garden, and for all the other sins of man since then. We either follow Him or follow our own desires. One brings peace, joy and a contentment in any circumstance that there are no words to describe. The other produces the opposite. It has always been that way.
pearls. swine. rend.
Get ready, here it comes.
I believe, what we do, are His desires, and that He knows about them before we are born, and He creates us, knowing what we will choose.