Some people believe that creating imaginary friends is a deliberate process, and can be done by anyone who comes across the idea:
"You’ll create a tulpa by imagining a person in your head, and treating them as a person. The exact mechanism is unknown, but as you give a tulpa attention, and believe it can be a sentient person, it will grow into one, and act independently of you." https://www.tulpa.info/what-is-a-tulpa/