The world under consideration in this scripture is not the world in John 14:17 - Even the Spirit of truth, whom the world cannot receive, because it seeth him not, neither knoweth him, but ye knoweth him, for he dwelleth with you, and shall be in you.
The world that is under consideration in this scripture is the world of believers who have the indwelling of the Holy Spirit.
John 15:19 - If ye were of the world, the world would love his own, but because ye are not of the world, but I have chosen you out of the world, therefore the world hateth you.
John 17:9 - I pray for them. I pray not for the world, but to them which thou hast given me, for they are thine.
1 John 2:15 - Love not the world, neither the things that are in the world. If any man love the world, the love of the Father is not in him.
The world mentioned in John 3:16 is also the world of believers, not the wicked world of non-believers.