Behind a record surge in cocoa prices this year, a corner of financial markets that drives the cost of chocolate underwent a seismic shift: the hedge funds that oiled its workings headed for the exit.