When an iPhone is synced to an iTunes library new playlists created or purchases made on the device can sync back to the iTunes library, but in principle media syncing is from library to device, not the other way around. You are expected to maintain your full library on a computer, back it up, and transfer it to a new computer when needed.
Despite Apple's obvious intentions iTunes is not yet dead, and it is still a much more capable app than the new suite designed to replace it. You can uninstall Apple Music, Apple Devices, and Apple TV, at which point iTunes will no longer be limited to working with audiobooks and podcasts. Should you need to reinstall it can be found here:
If you are in the position where you need to reclaim your music content from your device see Recover your iTunes library from your iPod or iOS device - Apple Community. The easiest method may be a temporary subscription to the Apple Music service, merging the music on the device into an iCloud Music Library which you then download to a computer and backup for security.
tt2