Putin doesn't know that. Putin doesn't know quite what the repercussions would be. That's why he hasn't used them so far.
The reason the EU countries don’t just waltz into Ukraine probably has more to do with the knowledge they’re not dealing with a rational person, but with a bunch of ego. It’s not hard to predict how Putin will respond if his ego is threatened, but how the rest of Russia will respond to the command to launch nukes.
It’s not unlike the US, except it’s currently still fairly easy to predict that any US commander will just say no when ordered to fire on the EU.
(I expect a first response would be a single city, with warnings to evacuate. A show of what's next.)
The goal would be that Russians assist in taking out an out of control, lunatic who will destroy us all.
Understand, this isn't just about today. Over the next 100 years, every country will obtain the capacity for nukes. Every person on this planet needs to see, and know that using them indiscriminately means you lose.
The consequences are too dire otherwise.
And when a US city is taken out in response? Do you keep going? Over a country that ultimately has very little impact on the US?
Your premise is basically that US military leaders are irrational to the point of insanity.
This isn't a game you win by backing off. There is no safety in that move.
Understand, the claim that the Ukraine is "Russian" is an absurd bluff. No one truly believes that, not Putin certainly. There are a dozen other countries in that region that Putin could make the same bluff about.
By allowing this bluff to continue for this long, matters have only gotten worse. We allowed 2014 to happen. Now, we're here. It won't stop a a peace agreement, or at Ukraine in whole.
The insanity is Russian. And you don't leave a rambling, insane man with a gun outside your house, shooting randomly at houses, because they're not quite at your doorstep yet.
And of course there can be an advantage for Russia in using nukes. They could destroy Ukraine's entire army, kill all its leaders, destroy all its infrastructure, etc. with no risk of (nuclear) retaliation. There would be many negative consequences too, so it's not likely to happen unless the conventional war is going very badly for Russia, but it's certainly a card they hold.