That isn't exactly what happened. Yeah Ukraine sign a deal with Russia and the USA (and Germany, and Uk and France) to give their nuclear weapons to Russia however:
1. The made this deal with the Soviet Union not Russia. The people who were governing the USSR were way more logical, diplomatic and less aggressive than Putin.
2. It was never really their weapons in the first place. While the Ukraine was apart of the soviet union a majority of their arsenal especially pertaining to nukes were stored in Ukraine. So when Ukraine gained independence in August of 1991 a few months prior signing the treaty, it was expected for them to turn over something as big as a nukes back to their rightful owners. If they hadn't that would've been a huge no-no for other major powers as well especially the USA because we weren't exactly on friendly terms with Ukraine either at the time. If they hadn't they probably wouldn't be allowed or be somewhat limited into entering the world economy and their newly independent nation would've either crumbled or struggle tremendously. Obviously this was not an option for the government of Ukraine because again living under the USSR was hell.
3. Exactly 24 days after the treaty was sign the USSR collapse. Remember the USSR was on the same level of power and influence as the USA at time so there was absolutely no way anyone could've predicted that.
tl;dr Ukraine didn't have a choice and people who like to meme and shit on it are ahistorical tards who enjoy the benefit of 20/20 hindsight.