Have you ever had that moment when you are in a current situation, usually a good one, but can be a bad situation, too, when you ask yourself the question, "How did I get here?" What is that moment, or phenomena, called?
It might be a moment of stupefaction, the state of being stupefied.
A person is stupefied when they are shocked, amazed, dumbfounded or overwhelmed. If the shock arises from the circumstances in which one finds oneself, then introspective reflection and a sense of wonder may ensue.
Consider whether the emotion described in the original post might overcome the person in the example Merriam-Webster gives for stupefaction:
"Upon hearing the diagnosis of cancer, she just sat there in total stupefaction."