Quite true that you may not be able to trust the OS or other application for such detection if someone has already accessed your device. Although this is not foolproof across all devices, they have made pretty good progress, and it may have useful applications too for areas where recording is prohibited, as it is applied externally from any device.
TickTock as a prototype consists of a near-field probe, a radio-frequency amplifier, software defined radio (SDR) and a Raspberry Pi 4 Model B. The researchers envision the device's final form will be similar to a USB drive, one that can be placed next to, or clipped to, a laptop to alert the user to any change in the device's mic status.
See
Boffins build microphone safety kit to detect eavesdroppers#
technology #
spying #
recording #
microphones #
privacy TickTock mic lock won't work on Apple