Until they switch currencies. For instance Brazil did this
> The cruzeiro (Portuguese pronunciation: [kɾuˈzejɾu]) was the currency of Brazil from 1942 to 1986 (two distinct currencies) and again between 1990 and 1993. In August 1993 it was replaced by the short-lived Cruzeiro Real, itself replaced less than a year aftwards by the Real.
India also demonitized a certain denomination of their currency
> On 8 November 2016, the Government of India announced the demonetisation of all ₹500 and ₹1,000 banknotes of the Mahatma Gandhi Series. It also announced the issuance of new ₹500 and ₹2,000 banknotes in exchange for the demonetised banknotes.
But people still need it to pay taxes and the government will only pay for services with it.
In most developed nations, the government is responsible for 20%+ of the total GDP, so that's an inbuilt "floor" to the value of its currency.
So yes, the government can change the currency and the notes, but they control the supply and demand of whatever they deem to be the currency.
Except in the last case, if you use your own keys, you have a choice of either going to jail and keeping the money, or giving it away in exchange for your freedom. In all other cases the only option to hold on to the property - is successfully physically fight with law enforcement to defend your rights to the property (which is quite futile for the most of us).
That's a key difference because it's only in the latter case that taxation creates demand.