Second, from what I understand, the first gold coins that were intended as currency were made of gold precisely because gold was already valued for other reasons. I do know that historically speaking, the value of gold coins was usually unrelated to the price of their gold contents, so it is true that they played the role of an IOU. However, (a) there is a reason why governments chose gold rather than a different material (psychology based on the pre-existing value of gold), and (b) throughout the ages, gold was also used as a payment-commodity in trade.
That latter use is probably overstated by the goldbugs, but it would be wrong to dismiss it entirely.
Gold was around production costs ($250) before the "general commodity bull-run 2001-2011" and is now back at around production costs (nowadays roughly around $11xx - $12xx, many opinions about this and different ways to quantify but production costs are in this range these days, no longer in the low hundreds as 12 years ago).
Gold coins are not the same, and are similar to IOUs as you mention. But gold does not base its value off the fact that at one point it was used as a currency.