Main switch circuit with thyristor and bridge problem
If you were able to safely monitor the signal on the lamp you would find a classic phase-controlled AC waveform.



Figure 1. Triac control of AC power.

A dimmer will delay the power-on to achieve the required output power.

Any 2-wire electronic switch has two options for its self-power:




If the turn-on of the thyristor (1) is delayed a few degrees after zero-cross then the voltage drop across the switch can be used to charge a capacitor - C1 (2). The chip is probably monitoring the zero-cross on pin 5 (3) and a time delay set by one of the other capacitors will initiate the thyristor trigger.
Another method would be to switch the output off for a full cycle and use the voltage drop to charge the capacitor. This has the major disadvantage that the flicker would be noticable.