You don’t need to erase your data.
The reason they tell everyone to back up their data before sending it in is because sometimes things go wrong when opening up the phone and the phone becomes damaged beyond repair – unusable.
When that happens (and sometimes it does) they’ll provide a replacement iPhone- but it obviously won’t have your data on it. If you have a backup, you can restore it from the backup and have everything in order once again with no problems.
An apple tech once told me that opening up newer iPhones is like open heart surgery on a person— it’s risky.
Back up your iPhone via iCloud or to your Mac/PC.