Treaties between countries aren't worth much more than the paper they are written on if the parties to the treaty don't believe the others are going to stay true to their word. That said, it is perfectly normal for political upheavals to spread beyond a nation's domestic situation. Russia itself made such an argument against upholding its old treaties after the revolution of 1917:
'[tlhe revolution of 1917, which completely destroyed all the old economic, social and political relations and replaced the old society with a new one, transferring the state government power in Russia to a new social class on the strength of the sovereignty of the people [...] which had revolted, thereby severed the succession of civil obligations which were a component part of the economic relations of the society which had disappeared, and which passed away along with it.
- Statement of Delegation of the RSFSR and Union Republics to the Genoa Conference of 1922 (Source)
Why Should I Trust You?
Going back on any agreement is going to cause a decrease in that nation's reputation if the population and their leaders suspect that a previous agreement wasn't in their best interests and unilaterally decides not to uphold their end of the bargain. Even in the case of a new nation arising as a result of revolution, it may be hard for other nations to believe that such a state would survive for very long, so negotiating long term treaties may be difficult. From that point there are two options: completely disregard the previous agreement and either pronounce it null and void (or just pretend like it didn't exist in the first place), or try to negotiate a new agreement. The second option is tried all the time, Brexit in some sense is exactly this; the UK felt that a previous agreement they entered in to wasn't in their best interests and decided to go it alone while attempting to negotiate new agreements. You may find, however, that just because you believe you can get a better deal than you did before doesn't necessarily make it so.
The Only Constant In Life Is Change
Human beings in my opinion are (generally) pretty fickle, so it is natural for people to believe that as time goes by and circumstances change different opportunities may be better to pursue than what the status quo is currently. But to unilaterally decide that a previous agreement is not something that you are interested in upholding is hard to pull off without other nations questioning whether or not any new agreement will actually be upheld in the future. Why should anyone trust what you say now, if, in the future, you may just go back on your word? If the situation exists, as it did in 1917, where it is easy to argue that the previous Nation and the current Nation should be thought of as two distinct entities, then arguing that the previous treaties are null and void is much easier. There's still going to be a reason those agreements existed in the first place, so you should not assume other countries won't react to such a pronouncement if you truly wish to avoid conflict, as everyone gets to act in their own self-interests.
Here is another source that explores this further from the point of view of the United States withdrawing from the Paris Agreement and JCPOA. It should be noted that in both cases there were stipulations in the treaties for withdrawing so the situation is slightly different than just simply ignoring the treaty altogether.
In the specific case of the Budapest Memorandum, there was no built-in method for withdrawing from it. From everyone's else's point-of-view, the correct way to change it would be to negotiate a new agreement. There is of course the option to go to war if you don't get your way, but that choice carries consequences also.