I have gotten stuck in that same cycle SEVERAL times in the last decade or so. Sometimes you look at the numbers in and out and it looks like, by the math, you should be losing and you just DON'T. It's so frustrating to be doing everything "right" and not seeing weight loss results.
I can tell you that after several cycles of this, I began to realize that if I am doing intense workouts, I do not lose weight, period. If I'm doing a ton of intervals and really heavy lifting, my body just FREEZES. Or gains.
When I'm doing lighter stuff, lots of walking and easy step and barre, I CAN lose!! It took literally YEARS of experimentation to discover this. My body goes into some kind of conservation mode when I'm doing intense workouts. SO. . . I just don't, much, anymore. When I keep my workouts more intermediate, it's like a miracle happens. I just do one more advanced strength workout a week.
I do believe it's basically about calories in and calories out, and intense exercise = more calories out. However, your body does have compensatory mechanisms that kick in, because while your goal is weight loss, your body's goal is homeostasis. So you might need to do lighter workouts so you don't scare it.