Apple offers iTunes Match [1], a service that is separate from Apple Music. It is something like $25 a year and does more or less what you're asking for here, especially in conjunction with Apple Music.
also itunes match is included in apple music and you can mix and match apple music and match (or local songs and if they are not local), you can also sync these with any device
[1]: https://support.apple.com/en-us/HT204146