mountedenzyme Most cases like this have root causes from childhood trauma. Can be anything from when memories start form at around 4-5 to 13-15. Usually when trauma happens after late puberty they have developed coping skills to be able to digest the trauma when it happens, and they usually already are good at talking about feelings.
Alternatively you have regular adult PTSD from something happening while adult, but that doesn't fit the story you wrote in the OP.
So if anything serious enough happen too early and no adults are catching it and guilding them through it, they will just look at it as that's just how the world is and works, and the fault is probably theirs for it to happen. That's typical children behavior. They always defend their grownups.
But if a trauma is big enough it will stay with them for the rest of their life until they deal with it. Until then it will torment them in various ways, and cause them to behave bizarrely in so many different ways. The visible behavior is a mix of memories surfacing and them trying to find ANY way to dig it down. The older they get, the more elaborate routines and methods they develop. For other people when looking from outside it looks like they are busy with something specific, and maybe even something important. But if you start peek into what is actually happening, and unpack what is being done, you'll see there is no apparent meaning behind. Just layers and layers of meaningless behavior.
Until you let them become comfortable and start give hints about what is actually going on. The hints are not easy to spot. That's why I suggest find someone with experience in this. Doesn't have to be a paid professional. Just need to be someone who understand this, and can get your friend to start give more hints. Bit by bit. It's a ball that has to sloooowly start rolling, and keep rolling for a long time.
There's a rather large % of the population that is struggling with things like this. If you walk into a room filled with people you'll find at least one, if not multiple in a similar, yet different, situation. Then you have all the others who never went into that room. It's so common it should be taught in highschool at the latest. The most visible behavior on the surface look different in all the cases, but if looking past the first layers, they all start look the same. 8 billion people on the planet, and we still behave the same way underneath, with minor cultural differences.