Gold has material use. You can make things with it.
It reminds me of an anecdote from my grandfather from the end of WW2, people were giving away gold rings for loaves of bread. (Clearly, only when in desperate need, but it did happen.)
Even if the US government ceases to exist, the features of non reproducibility built into cash dollars (watermarks, intaglio printing) would still exist although they won't be as ultimately durable into the future as an element. At least you can also use them as fire starters.
And people with guns are going to quickly steal your gold anyway.