Is there a way to change the iTunes Store country and still keep the Apple Music library? Preferably in an automated way.
The reason for asking is that the Apple support article on changing the iTunes Store country or region says that your Apple Music library will be lost if changing the country and does not offer any workarounds:
You won’t see the items from your iCloud Music Library that you matched, uploaded, or added from the previous country’s store
I have spent considerable time on building up my music library (adding from Apple Music) and would not like to lose it just because I'm moving to another country.
In my case it is not an option to use multiple Apple IDs or keep using the old iTunes Store country. Device versions are iOS 10 and macOS Sierra.