They could but in this case Ukraine is in the same predicament as Iran. The moment they make the dash for the bomb and anyone finds out before they have proper deterrence… the only course of action for the opposition would be to either conventionally or nuclear Armageddon … if they deem you having the bomb unacceptable. So there is that.
And as far as I know, Russian nuclear doctrine will require them to use nukes in this instance, as they are unable to do it conventionally, and it absolutely meets the criteria of threatening the existence of the Russian state.
In the case of Iran, this is the reason the US deployed the B2 spirit last month to bomb the houthis… it was to remind everyone (especially Iran) of the capability the US has to either fly these B2 with deep penetrators (like they did against the houthis)… or if need be nuclear armed bombs.
Surrender now only happens when they are out of ammo and cut off. If you read the stories and the the footage of Ukrainian warriors… they fight like lions… but sometimes you just get overrun.