In a technical sense, yes, but you need to think about what's on the other side: there will be a piezo driver amplifier, which may be driven directly from a digital output such as I2S audio from the phone ASIC.
Without some sort of preamp-ADC combination wired to the speaker, there's no way for software on the phone to use it as a microphone.