......It just won't happen the way you say. And let me explain why.
Ukraine is the one that is defending the city, set aside the casualty ratio. defender enjoy every advantage except for one. That's the attacker enjoy the latitude of deployment, because the deployment area for the attacker is ALWAYS bigger than the defender, for example, Russia can deploy their force 100 meters away from Bakhmut and use those troop to attack, it would be pointless for Ukraine to deploy troop 100 meters away from Bakhmut trying to defend it. Which mean Attacker ALWAYS enjoy numerical superiority if they choose to, because there are more deployment area the attacker have than the defender.
Which mean Ukrainian garrison is going to be smaller. The thing with smaller garrison, you always suffer less casualty because you cannot put a lot of people on the frontline. On the other hand, as long as the road to retreat is not cut off, if Ukraine suffer extreme casualty and playbook dictate they withdraw from Bakhmut and not continue with ts casualty. Which mean the option were there, if Ukraine suffer catastrophic loss, they would rather withdraw to preserve their force and put it elsewhere, then to reinforce the garrison.
Which translate to once the Ukrainian suffer unacceptable losses. They will simply withdraw from Bakhmut and hold on to the next town or defensive line. There are no tangible asset ties into Bakhmut, the reason to stay is not as much as the reason to withdraw. Which mean if Ukraine stay and fight, it would be with their leisure. They can afford to do so and hence they stay, unlike Russia, Russia have to attack to keep the momentum as an invader, Ukraine can defend anywhere, for Ukraine, Bakhmut is probably the same value than as Chariv Yar or Ivanivske Because Russia is not pressing against Ukraine against the wall, it's not like the Russia is on Kyiv doorstep like they did last year, This give Ukraine choice to trade ground with time.