Concentrations of dark haloes emerge from their merger histories