That’s why I said “for most of human history”. In the last 300 years, it’s found niche uses in areas like watch cases and dental work, and now, as you say, in electronics. But it was the first metal to be exploited by ancient humans - its known history goes back at least 10,000 years - and for the great majority of that time it was useless. Nevertheless, it has always been highly valued.
It is a perverse fact of economics that one of our least useful resources should always have been one of the most expensive. It seems to overturn Abraham Maslow’s theory of heirarchy of needs.
The answer, of course, lies in the rarity, beauty, and incorruptibility of gold. It looks good - it always looks good - and it’s very hard to obtain. Only powerful, successful, people can have it - so it becomes a symbol of power.