I had the same interest and came up with this workaround using Voice Control.
First, make sure Voice Control is enabled in Settings (Accessibility → Voice Control).
Then say the following:
- Start Recording Commands
- Open Settings
- Open App Switcher
- Show Grid
- Swipe Up 20 (or whatever number is over Settings)
- Open Settings
- Scroll Down (repeat until you can see the Accessibility section)
- Tap Accessibility
- Tap Touch
- Tap Call Audio Routing (might need to say "Scroll Down" first if the option isn't displayed)
- Tap Speaker
- Go Home
- Stop Recording Commands
Then, give the command a name (ex. Answer with Speaker)
Go through the same process again, changing step 11 and giving those commands a new name.
When you want to switch the call audio routing setting, just say "Answer with Speaker” (with Voice Control enabled).
The first few steps ensure that the Settings app will start on the home screen — in case the Settings app had been left on another screen from before.
Best,
Dave