Does the brain have a 'debugging mode'? In computer programming we have a debugger that we can use to execute a program step by step. In that mode, the program can be suspended and we can analyze the state of the hardware, modify the state and control the flow of the program to experiment.

Now, the question: Does the brain have something similar? Like a "debugger mode" in which it can reflect about or analyze its internal structures?
I think this is the mode that therapists use to analyze behavior, isn't it?
Short answer: Not a debugger, but possibly a control flow override.

Long answer:

This is a common fallacy known as the introspection illusion:


  The introspection illusion is a cognitive bias in which people wrongly
  think they have direct insight into the origins of their mental
  states. ... In certain situations, this illusion leads people to make
  confident but false explanations of their own behavior (called "causal
  theories"1) or inaccurate predictions of their future mental states.


It was long thought that self-focus, meditation, concentration, hypnosis, self-reflection, psychoactive chemicals, and similar techniques can help improve one's insight into their brain's functioning, mental state, decision-making process, cause of emotions, buried memories, and other such private information.  However, research has repeatedly demonstrated that this is not the case - it is at best an illusion, where people fill in gaps with confabulated self-knowledge that they do not actually have access to.

There are too many examples of this to list here, but check out choice blindness (people give explanations for decisions that they did not make), misattribution of arousal (people misattribute the causes of their emotions), and memory confabulation (people confidently recollect incorrect memories) for some well-known cases.

More in-depth literature on the subject can be found in a review by Silva &amp; Gendolla (2001) of over 30 years of research into an informal theory called the "perceptual accuracy hypothesis" that claims (but no evidence supports this) that self-focus increases accuracy of self-knowledge in a wide variety of aspects of the self.  Another review by Wilson &amp; Dunn (2003), notes the lack of evidence for any potential for improvement of self-knowledge using introspection.  A more modern review by Bollich, Johannet, and Vazire1 (2011) comes to essentially the same conclusion:


  ... we conclude that the road to self-knowledge likely cannot be
  traveled alone but must be traveled with close others who can help
  shed light on our blind spots.


For some decades now, computer scientists have been attempting to reproduce the function of the brain using artificial neural networks, with some success.  An interesting aspect of neural networks is that they, like the brain, also do not have a debugger - at least not a useful one.  Ask a programmer to explain why their neural network misclassified a training input, and they will respond with a statistical analysis and abstract mathematical model that describes the overall system, not a coherent reason like “it thought this R was an A, so assumed the word was gain instead of grin…”  The only way to get such an explanation is to look at the result, and then guess.

The kind of "talk therapy" psychotherapy (such as CBT) that you ask about has been demonstrated to be more effective than placebo, so we know that something about it works, but what about it works is not well understood.  Perhaps even the illusion of insight has some therapeutic effect, or perhaps there is a cognitive override mechanism at work.

Dual process theory is a well established idea that suggests that we have such a mechanism of control override that allows us (like some debuggers) to change the progression of mental processes mid-way.  This is typically the role believed to be played by our "conscious" mind.