Maintenance and gaining muscles

I just decided that I have achieved my weight loss goal.
I’m starting to learn and test how to be in maintenance. I would like to put on some muscle and gain strength. And I catch myself being afraid of gaining the weight back. My mind wants to make it mean that I’m a failure.

I found a way to switch the attitude :

Old model
C: Current weight
T: You’re failing by gaining all the weight back
F: Panic
A: Indulging in food, searching for reason that I’m a failure, blaming myself, not focusing on my goals at the gym
R: I’m gaining weight back again the next day

Still old
C: New fasting protocol
T: I need to fast to lose weight again
F: Panic
A: Resisting myself, not wanting to do it, finding excuses to not fast, not exercising as much as I would like, letting myself be confused about my long term goal
R: Gaining weight (? Not sure about the result)

New model
C: New fasting protocol
T: It will help me gain muscle and strength
F: Enthusiastic
A: I plan for the new protocol, find ways to make it easy, search for all the good reasons it will help me in other areas of my life so I train better with more weights and more energy
R : I gain muscle and get stronger

Thank you for your thoughts about this