That’s IMHO a slippery slope and one needs to be a bit careful here. Yes, of course, in fact a microphone is nothing else as a specialized speaker - or vc.vs. A membrane and some sort of electrical pieces that can translate either electric current into movement of the membrane or vc.vs.
So yes, in theory this is possible. But… the system is not only comprise of that acoustic transducer, there is a lot more to it. Going backward from the speaker first there is an amplifier. The digital/analog (D/A) converter of the audio codec usually can not drive a speaker on its own since a speaker needs power, like real power (in terms of Watt) so that you can hear anything. But these amplifiers are physical units, i.e. not some programmable thing, these are a bunch of transistors with capacitors etc. - and these only work in one direction, they take the weak signal from the D/A and amplify it. These do not work backwards, they simply can’t, there is not current flowing.
Some codecs allow pins to be reconfigured, like muxing on micrcontrollers. You can map inputs and outputs to arbitrary pins. So let’s assume the speakers are connected to pins of the codec that could be turned from output into input. This would not result in any audible signal from the “speakers”, it will not turn the speakers in microphones since the amplifier is still sitting in between and it will not backdrive anything to the input. So unless you can also circumvent the amplifier there is no way to do that.
In current devices, i.e. also our current devices, we use codecs which include the amplifier for the speakers in the codec chip itself. It’s not the most powerful amp (IIRC just .5Watt) but enough to drive the built in speakers. These codecs have dedicated pins for these amplified outputs and these pins, as far as I can see in the codec documentation, can not be reprogrammed as inputs.
This is e.g. the codec used in the Librem14 laptop:
On the left are the pins 42-45 which drive the speakers, these are dedicated amplified pins not suitable for anything else than driving the built in speakers. Same thing applies to the Librem5 phone (other codec but same principle, amplifier sitting in between which can not be repurposed). The Librem Mini does not even have speakers.
So at least for our devices (and I am pretty sure this applies to most other devices too) turning a built-in speaker into a (spying) microphone is only a theoretical but not a practical problem.
The attack description I have found seems only to apply to some of the other I/O of the codec, e.g. use for line in/out or the headphone jack. I think before we implement another hardware kill switch it is way easier to just advise to unplug your headphones instead…