An old guy who was locked up for a while described this as a literal survival tactic for when he was in solitary. He likened it to making a partition on your brain’s hard drive, like a different self who you could interact with or simulate to pass the time spents sitting in a room staring at the wall.
So maybe there’s something to it.