The cause is that the readout speed of the sensor is too slow (eg 1\50s), so the lights turn off and on while the sensor is reading different parts of the image. Even if you use a very fast shutter time like 1\500s
Mechanical shutter solves this as it wipes the entire sensor in like 1\200s, so the brightness change in the scene doesn't change significantly from top to bottom.
Get a faster read camera like Canon R3, Nikon Z8\9. Or use mechanical shutter.