If you pause your subscription or change Apple ID region, Apple wipes the whole library. once I learned it the hard way, and since then worried about backing up my collection of 6k songs sorted by 100+ playlists
I made a very simple script to save all Apple Music playlists as a single JSON containing playlist name, artist, song title and ISRC identifier (which can be used to find song elsewhere and migrate the library). Run locally after getting Apple authorization token from browser session.