A historic surge in commodity prices after Russia’s invasion of Ukraine, coming on top of already-high pandemic inflation, has gotten investors and economists searching for parallels with the energy shocks of four decades ago and the prolonged slowdowns that followed.