People understandably see this from an operational/tactical viewpoint where people calculate where it makes sense to retreat or stay and fight till the end for each city/village/settlement.
However if you see this politically, Ukraine must defend literally every inch of its territory so that when the time comes for negotiations it will only lose the minimum territory that Russia has gained.
So yes, even ignoring a lot of casualties, and given that military victory is impossible for each side now, its in Ukraine's interest to defend as much as possible.
Once you lose land in an official diplomatic treaty, that land is gone forever. If you lose, lets say, some 20000 extra soldiers for defending a territory, that's not a big deal. Every year, babies are born all the time. Of course it will damage its national comprehensive power but given the state it is, that Ukraine is already in the abyss, if it moves a couple of metres more inside I don't think it will care.