You are right. Apple's iTunes software is designed to transfer data from the computer to their devices but not in the other direction. In general if you try to connect and sync an Apple device to a new library iTunes will want to erase all the current media content and replace it with items from the new library.
Should you be in the unfortunate position where your computer crashed and you have no viable backup of your library then you can use the steps below to attempt to recover most, if not all, of your media and other information from your devices. If, however the library that has been lost or damaged was on your current computer see Empty/corrupt iTunes library after upgrade/crash first.
Recover your iTunes library from your iPo… - Apple Community