My understanding is that they gave up the USSR's weapons (and handed them to Russia), rather than them having built, owned and dismantled the weapons outright through their own nuclear program.

They could have spent substantial effort to make those weapons "theirs" (I've heard people simplify this as "they didn't have the codes but could figure them out") but it would have cost them dearly in international sanctions, versus the assurances and aid they could negotiate by relinquishing them.