Light bulb burns out -- why there is an arc in the switch?
When the lamps fails, it is often the case that the delicate filament collapes on itself, causing a short circuit. This causes a momentary peak of current. So much current that the short almost immediately blows itself open circuit again, due to a teeny explosion.

The lamp usually fails when switched on because the resistance of most materials, including the lamp filament, rises with temperature. When cold, it draws far more current than when hot- 10 or 15 times as much. So that is when the filament is under the most stress as it very rapidly heats up, so by far the most likely time for it to break. Additionally, it is because the AC wave is partway through rather than passing through zero, causing a sudden buildup of the electromagnetic field, causing a physical shock to affect the filament too.

Incandescent filament lamps last much longer if you never switch them off and on, for these reasons.

So to answer the question, the flash in the switch is caused by the failure.