The origin of hysteresis in the flag instability