The way they're behaving is quite rational. They looked at what happened to Gaddafi and Saddam, as well as how the new administration is seeking to tear down the Iran deal, and came to the conclusion that the US/West could not be trusted to honor a nuclear disarment deal long term.
This means a credible nuclear deterrent is the only way to ensure the regime's survival.
Lest people think I'm engaging in apologetics, what they're doing to keep in power is reprehensible. But they're not mad men looking for a symbolic "win" at the cost of suicide.