Gold has surged and even beaten stocks in recent years—but long-term history, inflation, and a costly investing lesson argue for caution.