It’s unlikely that certain part replacements (such as battery) would lead to data loss. Only when the device has the firmware reinstalled, which the service centre may or may not recommend anyway.
That being said, it’s always advised to do a backup first regardless of what service needs to be carried out on your device.