"In" κόσμος cannot be literally locative. The only person he was "in" was Mary when he was a baby.
At J 17:15 Jesus did not ask that his disciples be taken "out" of ο κόσμος.
At J 17:18 Jesus said just as the Father sent him into ο κόσμος, he sent his disciples into ο κόσμος. When he did that they were already around people.
If you force a literal heaven vs earth, then did the Father send Jesus into the world from heaven? Remember you said, did Jesus say this from heaven?
Being "in" the world is a special sense that describes the evangelizing work for κόσμος.
It doesn't matter, pick your definition of ο κόσμος :
(1) the physical world, i. e. the universe, (2) the circle of the earth, the earth, (3) the inhabitants of the world, (4) the ungodly multitude; the whole mass of men alienated from God ,(5) the World system,
The statement Jesus made at John 17:11 would be false if not seen proleptically.
Unless you want a self-serving, unbiblical definition of ο κόσμος as "stoppage of preaching by Jesus." Even then, hilariously, his statement at John 17:11 would be false.