"As the lighting is required to keep the power factor under control, it means the DC voltage is poorly filtered..."
When do we need a rectifier? I suppose not with fluorescents where AC voltage is no problem. Multi LED lamps can operate with both halves of the sine period without a rectifier. You mean a single LED lamp...?
Beside few exceptions (phase cut dimmers), virtually electronic works on DC, include the electronic ballasts, either for fluorescents, LED's, HID's, even the electronic "230/12V trancsformer" for the 12V halogens,...
So any electronic ballast has to first convert the mains AC to the DC needed to supply the main ballasting circuit.
The rectified DC voltage is then chopped by the inverter stage to create the high frequency for the final lamp circuit (with LED and HID that mean second rectification). Now as the DC voltage is not 100% filtered, it means it vary over the mains cycle. Because the mains cycle is many times longer than the high frequency, the generated high frequency become amplitude modulated by that ripple. But that mean the HF output to the lamp is varying. And it is this variation, which is then causes the lamp to flicker, more variations means more flicker and vice versa. And when there would be no filter on the rectified DC, the voltage will completely disappear, so will the inverter output. But with most of the circuits, the variation could be suppressed to some extend by modifying other inverter output parameters like frequency and/or duty ratio. But the working range of these methods is rather limited, so for continuous operation you need some storage (filter), what will cover the parts of the mains cycle, when the mains is insufficient.
With fluorescents the aim is to keep the discharge burning without interruption, it needs just reduced power to keep the arc alive as the minimum, so the filter capacitor could be minimalistic.
For LED's the interruption is no problem, so you do not need the filter at all, so you may design the inverter with (followed by a second rectifier, so forms a DCDC converter) so, it's input current follows the voltage, so in front of the rectifier it looks like very high power factor.
With the incandescent "transformer" the lamp don't care and it is by itself resistive, so it is fed directly by the modulated HFAC. It has the benefit of inherent high power factor, because the lamp current follows the lamp voltage, so does the inverter input current vs the rectified voltage.
But as the power to the lamp vary, the lamp flickers. Sometimes it is just annoying (fluorescents, LED), but sometimes it affect the lamp performance (HID), so the DC has to be filtered quite well and the inverter has to fully compensate that by modulating it's duty or frequency.
Do I understand well that those lamps with filtered rectifier in fact compensate the power factor for other magnetically ballasted lamps, motors etc.?
No. The non-unity power factor of magnetic ballasts is of fundamentally other nature than the non-unity power factor of the rectifiers. The thing is, to have really a unity power factor, the voltage and current gave to match in both shape and phase (as it happens on a plain resistor). As the mains is a sinewave, for unity power factor you need the load to draw sinewave input current without any phase shift from the voltage.
The concept of "phase shifts" and/or "complex number" is not even how the physics reality works, but it is just a mathematical aid (a substitution) to simplify the equations for a "special case" valid only for linear circuits with steady harmonic voltages/currents, all at the same frequency.
Well, the 99% of the AC power distribution does or could be simplified so to meet the criteria of the "linear circuit with steady state harmonic signals at a single frequency", and this mathematical simplification is so handy (it releaves you from complex derivation and integration math), so widely used and it could be used even without the knowledge of real math behind, you have to be always aware it is valid just for a special case, so before using it, you have to make sure all the signals meet the conditions or at least you know, how to mathematically convert them to their equivalents and what are the limitations of that conversion.
So the magnetic ballasts with a lamp could be simplified to a "linear system with steady state harmonic signals", so you can use that aid.
But for the nonlinear rectifier the current is not harmonic, so it means terms like "phase shift" or "reactive power" have no meaning at all, you have to stick with just the tedious operations of "derivation" and "integration".