Gold has been globally recognized as a currency forever, so it does not fall under the definition of fiat. Fiat is produced by a government and does not have to be backed up by anything of value.
You are correct about the bartering and the reason for currency though. Food has a value but not a lasting value as it is consumed, the real value is the means to either produce or buy more food.
Not really forever. For a few thousand years, and a lot of the world found it completely uninteresting until Europeans got there. But it’s still fiat currency. All currency gains its value ENTIRELY from people’s willingness to accept it in exchange for good and services. Gold is NOT anything of value UNTIL there are other people willing to take it in exchange for goods and services, it IS fiat currency. ALL currency is fiat currency. Always has been, always will be.