One study found that lonely people also engage in more imaginary conversations than those who don't consider themselves lonely. Perhaps ending up talking to oneself out loud is somehow related?
I have non-stop imaginary conversation. I think this might be backwards, you feel less the need to talk to real people if you're always talking to fake people IMO.
https://psychnewsdaily.com/lonely-people-have-a-unique-brain...