I don't think this was a predictor for the Ukraine invasion, but the rise in grain prices had begun prior to that.
The war in Ukraine exacerbated a trend that started because of poor EU green energy planning. A colleague of mine, who also happens to be a farmer, was talking about this before the war.
Basically, the EU badly overestimated how much renewable energy capacity they were going to have, which led to a large share of global natural gas being diverted to European energy demand. The alternative use for that natural gas was fertilizer production. Fertilizer prices skyrocketed, but there still wasn't enough to fertilize all the crop land. That led to a price spike that most people are attributing to the war, but was coming either way.