Maybe they did not have much choices, because they knew Russia would push through there soon anyways. By doing this, Ukraine accelerated their rate of losses, but that's not necessarily the incorrect decision. Ardennes offensive was launched for the same reason. Wait around longer and die slowly or attack with wildly unrealistic plans now, 1% chance of success and negotiated peace, if not we die faster.You take your reserve units that are fairly well intact, well equipped with tanks and armored vehicles, take them out of the cover of well dug fortifications to a place far from your supply lines and no cover from cities and no fortifications, to fight an enemy that has overwhelming firepower asymmetry and glide bombs. In the meantime, your defense in the cities with fortifications dug over eight years are crumbling quickly right before your eyes.
By staying in forts and attriting, perhaps even more Ukrainians will end up dying, as recruiters grab more elderly, teens and invalids off the streets, than if a corps is decisively defeated and the war ends faster. A smart general would go for the option that has at least some chance of improved result, while sparing the population from prolonged torture, if the end result is going to be the same anyways.
It's not even a PR victory yet, just another engagement that is already going poorly for Ukraine.This short lived PR victory will be very costly.