Historical contingency and productivity effects on food-chain length