I do not know if we are talking about the same things but the have been times when totally divorced from my body, and to a lesser extent my mind. I've not had an understanding of myself, my capabilities, emotions or the reasons for my actions. As an example I've watched myself get very angry and not known why.
The has been like looking at myself as an observer from the other side of a pane of glass.
These episodes have been a symptom of depression, anxiety and PTSD, and have totally gone away nowadays. They became less frequent as I improved. Improvement was not done by me, I played a part, but so did my medical team as well as my partner. Therapy, medication and the removal of the main stressor, together with time, made the difference.
Does this sound anything like you were referring to?