What happens to your voicemail greeting when you "erase all contents and settings?"
Make back up.

Scan your Mac to locate iPhone backups. Then locate the voicemail greeting by going to this location:

System Files/Home Domain/Library/Voicemail


Inside the Voicemail folder locate the greeting.amr file. Select it and click the Export button to save a copy on your Mac’s Desktop. Double-click this file to listen to it to make sure it’s the file you want to retrieve. If so, you’re now ready to restore this file to your iPhone.