Replacing a magnetic speaker with a non-magnetic one
Shielding the speaker is liable to be the best choice - if the existing shielding is in fact inadequate. Mu metal works magic but iron sheet may work well enough.

If the speaker does have some effect it may be able to be 'swung' as is done traditionally with ships to correct for compass bias - but this may run you afoul of the dread paperwork. Compass swinging is already a part of regulatory requirements for many aircraft (maybe not yours?).
This page may help -
https://www.aviationpros.com/aircraft/article/10385554/aircraft-compass-swing

NZ regulatory requirements and methods

___________________________

I'd assume that this problem is already extremely well known and dealt with by others. What do others do?

You could indeed produce a magnetic drive to piezo-sound-better unit, and they probably exist, but trying the above first may well be enough.