I think the main cause was actually under-stimulation: I was both very socially reclusive, and bored to death by schoolwork. I would guess that my brain was trying to compensate for the lack of social life and things to do by making up people and scenarios were stuff actually happens.
This tendency to constantly daydream faded away as I gained independance and entered adulthood. Since I had more stuff to do and more people to talk to. It kinda re-appeared during the 2020-2021 lockdowns, since boredom came back. I think I had almost forgot how it felt to intensely daydream at that point.