iTunes device backups are stored on the computer. Media itself is not backed up, though sync selections may be. Similarly iCloud backups do not include media, or content that is otherwise stored in the cloud. Details at Backup methods for iPhone or iPad - Apple Support.
Syncing a device to an unfamiliar library shouldn't be capable of removing content from the computer but it will remove content from the device if you proceed after the warning telling you that is what is going to happen. That said this isn't the first time I've heard this claim. Do you have any other devices, computers, backups, old hard drives, etc. that your media might be recovered from? Have you checked the media folder and not just the library listings? Have you installed any of Apple Music, Apple TV or Apple Devices? These apps functionally alter iTunes such that it then only manages audiobooks and podcasts. Removing them should restore iTunes to normal behaviour.
tt2