Hello m0xmx,
Your problem has no solution, it is a problem of the sensor, There was a series of M12 with that problem, I had to repair a few. Although this you can confirm it better in support.
You have a somewhat seedy solution, but it works temporarily.
If you have another M12 that works well, copy these sections and paste it into the M12 with the problem.
SECTION camdriver
SECTION imageimprover
Probably the problem will be solved until you do a reboot or randomly.
If this is not your problem, every time the sensor disappears, copy and paste the sections.
But in the end the only solution is to repair it or make a change to an M16.