Many mental health professionals promote the idea that the toddler creates alters to perform some function that applied to self protection. I believe that the toddler's brain just gets shattered by the abuse/trauma and that there is minimum sanity about having alters. For the most part is is just a symptom of a damaged mind. This whole mental illness involves switching in and out of hypnotic type states without control with the results of automatic amnesia.
The good news is that if you can get to a trained, competent, mental health professional, you can stop the switching or control it.