Stress can absolutely cause emotional responses and mood changes. When faced with something stressful it isn’t unusual to express yourself how you feel most comfortable. Some people may even retreat into that feeling of safety in expression in effort to escape the stress entirely.
So, anxiety means stress. Expressing yourself similarly to that as a child may give you some level of comfort. It wouldn’t be strange to react to stress in a childlike manner of outright retreat into feeling very childlike for some time in effort to manage the stress. Regression can be used as a tool to provide a more comfortable atmosphere while you actively work through a stressor.
While there’s nothing wrong with changing your methods of self-expression to more comfortably communicate or manage your current feelings, there can be an issue in avoidance. Avoidance may begin only sporadically but can quickly get out of control, leading to avoiding all conflict, stressors, and other important stressors that should be faced. Ultimately, retreating into regression is not a safe, reliable way of coping with anxiety, depression, or other mental health concerns. Allowing yourself to do so may cause more problems to be faced with later.
There is definitely a difference in using regression as a way to express yourself as you work through a stressor versus using regression as a way to shut down, escape, or avoid the stressor. This is an extremely important point. Regression is not bad, but it can be abused into becoming a bad habit.
You shouldn’t feel ashamed that you’ve experienced using regression to avoid a stressor this but you should do your best to keep this in check by talking about these responses with a professional. If you’re experiencing anxiety you should see a licensed therapist and work together to better manage these moments instead of emotionally responding by retreating. A good therapist can help so if you’re seeing one now but you’re not making progress then it’s probably time to find a different therapist to work with.