Honestly? It’s a great deterrent. Have you heard of a nuclear power being attacked for real? Ukraine disarmed voluntarily and see where that got them. Everyone should get nukes and threaten everyone (or „warn” if you’re Israel).
Mexican standoff nuclear doctrine, you’ve heard it here first.
It's pretty dumb as a deterrent because a single miscalculation and it would set off a chain reaction that ends human civilization.
Think of it this way: because nuclear missiles are not immediately traceable to their country of origin, each nuclear-armed country will immediately launch at their perceived enemies without validating who attacked them. All it takes is one launch. This might deter a sane person but we are led by narcissists and these are not rational people.