There seems to be two distinct failure modes that people are talking about here.
One is the beam’s rotation due to the destabilizing effect of the load being above the neutral axis. For such destabilizing loads, design codes prescribe an additional factor to increase the effective length, which several people above are discussing.
The other issue is the overall lateral translation of the beam and column assembly, where both elements sway laterally together without rotating relative to one another, as shown in Kootk’s first diagram.
The first scenario, beam instability, is more critical, as it results in a significantly greater “effective length” for design purposes.
Is you design the beam effective length as the real length, multiplied by the destabilising load factor, you will cover it.