This assessment assumes that gaining territory is the only thing that matters in warfare, which is the kind of assessment you make if you've never studied warfare.
What matters is not that Ukraine fell back from Avdiivka, it's what it cost Putin to take it. In other words, you can win a war by losing ground if you do it right. Russia should know this well; its how they beat the Nazis.
Ukraine's offensives tend not to see serious movement at the moment because when they meet strong resistance they back off. The Russians, on the other hand, hurl themselves into strong resistance over and over, at a huge cost in men and materiel. Essentially Ukraine is pursuing a strategy of allowing the Russians to grind themselves to death against their defences, while launching probing counterattacks to test the remaining strength of the Russian defences, never over-committing to the attack so as to minimise their own losses.
This strategy is effective because attacking a defensive position is always more costly and difficult than defending. Ukraine wants Russia to be on the attack, because that's where they can apply attrition most efficiently.