Hey there!
The main reason why your music is not recorded is because it's protected with copyright and cannot be duplicated and shared outside the music app you're using. The same result can be gotten in the Apple Music or TV app when trying to record a movie or a clip.
I hope this helped you 😊