I've heard conflicting reports that demagnetizing drivetrain parts to prevent metallic debris sticking is a real thing I'm supposed to care about when servicing e-bikes, but I can't find anything written about it or any instructions on how to do it. I do know that some of the more bling systems such as Bosch and the Copenhagen Wheel have magnetic torque sensors that are sensitive to external magnetic fields so I imagine care has to be taken there if this is a thing.
This is the first time I've heard of such thing. Here's my analysis of it.
I'm assuming the magnetising of the drive train is referring to the chain and rear sprocket (if it's a hub motor). These components could theoretically become magnetised through rubbing if they travel through a magnetic field in one direction (either north to south poles or vice versa). They have to contain iron for this to work.
Ebike motors are mostly brushless, which have permanent magnets inside. And also the chain and sprocket is often made of stainless steel (more below). So it sounds possible that those components could be magnetised as you would mostly pedal forwards.
However, here are some doubts to whether it needs to be demagnetised:
Magnets made from rubbing are only temporary. They lose their magnetic field over time and knocking.
The magnetic field around a brushless motor is complicated, as there are multiple permanent magnets inside arranged in a circular fashion. So any rubbing may be cancelled out by this arrangement.
Some stainless steel actually can't be magnetised. I haven't checked yet but you can by holding a fridge magnet and see if the chain and rear sprocket reacts to it.
The only debris that would stick due to magnetism is ferrous materials. Most debris in cities are not. But that would largely depend which geographical area you're in.
In conclusion, I'm very doubtful whether this is needed at all. And as you've mentioned, there are magnetic sensitive sensors on some Ebikes. Demagnetising could potentially damage them and the motor.
Some sites I used to confirm my understanding: