Giving up the nukes allowed Ukraine to attract foreign aid and build an economy for 20 years before invasions began. Who knows what would have happened if they kept nukes and didn't get necessary aid and couldn't build their economy or maintain the weapons.
All sorts of questions to ask. Yes, if our timeline was otherwise unchanged, but the nukes were kept and maintained, it seems unlikely that invasion in 2014 would have happened... But it's a big change to the timeline to keep the weapons, and there's too many unknowns to predict the resulting changes. I do strongly suspect few countries will accept similar assurances in the future, unless under duress, but then Ukraine wasn't exactly free from duress at the time either.
Given how insistent the international community was on making sure those nukes were disposed of, and how economically devastated post Soviet countries were, I don’t think Ukraine stood any chance of having a nuclear deterrent.