Maybe this is the vestiges of my Protestant background talking, but I believe that even though the word "world" is the same Greek word (kosmos) in all 3 passages (per Strong's Concordance), John 3:16 refers to the inhabitants of the world and 1 John 2:15 refers to the system that operates all that we see, in other words the world that is under Satan's dominion.
In John 17:9, I believe that Jesus was praying very specifically. In context:
“I have revealed you to those whom you gave me out of the world. They were yours; you gave them to me and they have obeyed your word. Now they know that everything you have given me comes from you. For I gave them the words you gave me and they accepted them. They knew with certainty that I came from you, and they believed that you sent me. I pray for them. I am not praying for the world, but for those you have given me, for they are yours..."
He was praying for those who were given to him, not the rest of "the world". Those whom He loved and who loved Him back were differentiated from the rest of the world