Nothing actually unmounts anything until you actively switch to the USBMS tool (and, even then, it'll do a bunch of more in-depth checks to avoid doing anything, to the best of the kernel's ability to actually report useful stuff (which is... subpar on Mk. < 7), if the host doesn't actually support data).
As for the actual popups, again, we simply trust what the kernel tells us, they should only happen when connecting to a host w/ a data line, but it's an ntx kernel, so it's full of weird little bugs

. (e.g., the PowerCover on the Sage is a great candidate for fucking things up on that front

).
That said, you can inhibit how we react to those events by toggling the canToggleMassStorage Device cap to false (I imagine it's probably easily done in a user patch, now).
But IMHO it's a red herring

. (I have, in fact, tested USBMS while connected to a CDP, and it's perfectly harmless, it just requires an unplug to exit).
(e.g., it's either a coincidence and the SD card died at the same time, or your esoteric charging setup and/or a wonky cable fried something and/or facilitated killing the card.
Plus, you know, KSM ;p. (snark aside, assuming non-catastrophic hardware failure, KSM does prevent you from recovering from that sort of stuff as easily as the stock boot, because it breaks the factory reset capabilities)).