Export Star ratings

I inadvertently deleted my Music (aka iTunes) library and upon restoring from Time machine, all Star Ratings are gone. Not sure if they can be retrieved.
I then exported a playlist from Lexicon to Apple Music, but the star ratings didn’t appear.
Is this normal? Is there a work around?

If you delete the tracks from iTunes before importing the XML again, the ratings should appear.

iTunes doens’t update existing tracks when importing an XML