That guarantee is sort of like the spark plug of the economy - because it exists (and because the US government was a thing) people initially believe in the value of a dollar (and the same thing happened with every currency) but the currency continues to have value (and has a value exceeding that initial US valuation) because other people will buy it as well.
Also, just for a moment, the statement: "Dollar has value, because even if no one will want dollar, government will buy it for dollar." - that's a fair bit of nonsense, outside of the dollar having an exchange value the dollar has no value - fiat currency (and even precious metals TBH) only have value to to the continued demand for them and if that demand falters or if people stop valuing a dollar at as many whoppers as it used to be valued - then bad things start to happen really fast and the government is pretty powerless to stop it once it starts.
Also, just for a moment, the statement: "Dollar has value, because even if no one will want dollar, government will buy it for dollar." - that's a fair bit of nonsense, outside of the dollar having an exchange value the dollar has no value - fiat currency (and even precious metals TBH) only have value to to the continued demand for them and if that demand falters or if people stop valuing a dollar at as many whoppers as it used to be valued - then bad things start to happen really fast and the government is pretty powerless to stop it once it starts.