Series of events leading up to the suspected bug:
Spawned in friend's world, with the chunk that the nether portal was in rendered, went towards the portal, ate baked potatoes as I went through the portal, finished eating before it went onto the dirt block loading screen, then I spawned in the middle of nowhere in the nether. My friend said that he had seen the "TheCakeDevourer joined the game" message as I said I was in the middle of nowhere.
What happened after the bug had occurred:
When I was in the nether, at first there was no portal to get back. But then I got disconnected (I left the game). When I joined back in the world as if by magic, a portal had appeared. I went through the portal, but I managed to end up 6000+ blocks away from (overworld) spawn and in a cave. I went back to the cave portal to go back to the nether and it bought me out where I had started (the middle of nowhere). Now I am armed with only wooden picks to get back, since my better one broke .
Thanks to silent whisperer for making a video on how to reproduce it