There are mic blocking apps on playstore. They all have high battery usage so I think they run a service that keeps on "stealing ownership" of the microphone to divert audio input.
Or maybe they overwrite the input stream with silence (is that even possible?) because those apps actually work. When I use voice recorder, the vu meter stays flat and there's nothing but silence in the output file.