Do you believe that God created them that way?
I believe that God is omniscient.
If there is any point at which He does not know something, then He is no longer omniscient.
So, yes, of course God knew some would worship the devil BEFORE He created the earth.