According AN4602, the chip can compensate thermal drift with internal temperature sensor
Not exactly. According to AN4602, the sensor "internally compensating sensitivity drift over temperature variations using an advanced embedded algorithm"
The above means that sensitivity of the device is compensated, not the absolute value. This is confirmed in FAQ on ST online support site:
We do some initial validation of LIS3MDL and experienced a problem when we do
a temperature cycle and no external magnetic field present. It seems like the
sensors get an offset in the output. We have tried to enable the TEMP_EN bit,
but the output is more or less the same.
In LIS3MDL please consider that embedded temperature compensation can be used
to reduce the thermal drift of the sensitivity, while it is not able to
compensate the thermal drift of the offset. Thermal drift can be up to +/-8mG/°C.
LIS3MDL is TMR sensor. New products like LSM303AGR are AMR technology sensors
and in those mechanism is available which is able to remove offset thermal drift.
So, you have two choices here. Either look for their new AMR sensors, or read thermal sensor output and compensate in your software.