In the process of exploring things non-Apple, I recently bought myself a Pixel 4a. Switching to Android, I naturally wanted to ensure on-going text messages didn't end up in an iMessage blackhole. Unfortunately, that's exactly what happened and I had to jump through some fairly convoluted hoops to work around it. Since it might be helpful to others, I've documented the steps here.
Start with the 'official' flow:
Remove the SIM from your iPhone / de-register your eSIM
iOS should offer to remove the number from iMessage. Agree to this.
Check your phone number has been removed
iOS isn't too reliable at removing numbers so you'll want to check step 1 worked. In Messages.app on macOS go to Messages > Preferences..., then Accounts:
If your phone number still appears in the section entitled You can be reached for messages at, uncheck it.
Unfortunately, after this, I still found friends' threads were reverting back to iMessage. It seems that, even if someone actively selects your phone number, Messages.app will continue to use iMessage if a) your contact card has any iMessage-enabled email, or b) any iMessage-enabled email was previously used in the thread. That's a pretty easy situation to find yourself in if you've ever used iCloud for email.
Ideally, we would completely disable iMessage at this point, but I was unable to find a way to do that. Neither is it possible to un-check all email addresses associated with iMessage. Instead, we have to trick iMessage into allowing us to disable our email addresses by offering a new one as tribute:
Register a new email with your iCloud account
View your Apple ID at https://appleid.apple.com/account/manage and click the Edit button in the Account section to allow you to edit your contact details. From here, click Add more... at the bottom of the Contactable At section, and follow the instructions on-screen to add a new email address that you've never shared with anyone else1.
Use the new email with iMessage and FaceTime
Shortly after adding the new email address, Messages.app on your Mac or iPhone will offer to use the new email address for iMessage and FaceTime. Agree to this.
Disable all other email sending identities
In Messages.app, Messages > Preferences..., Accounts should now include your new email address in the You can be reached for messages at section. If it is not checked, check it, and then un-check all the other email addresses.
Once these changes propagated, I found iMessage threads to correctly fail over to text message for all of my contacts. 🥳
N.B. I have a strong suspicion that sending another message using Messages would undo all this good work by leaking the new email address, so be cautious of that.