(For reference, I'm responding with such a long post because I have a pretty unique perspective to share compared to the hacker news crowd, and also, I wish someone had told me this too, when I was a teenager.)
I heard it five years ago and hated it because it sounds like slop, I heard it today and hated it because it sounds like slop. Game devs (the ones you actually want to work for that aren't just pulling asset flips), by and large hate AI art, and gamers by and large hate it too (There's a whole movement about not using it in games lol).
On top of that, professional musicians are so, so guilty of using music libraries to produce music — Guy Michelmore on Youtube (@ThinkSpaceEducation) has a really, really good video that I can't find right now, where he demonstrates using music libraries to bootstrap a composition. It's really unlikely to be the case that if you're working as a professional musician, that you're going to be producing all of the work of a given composition (even though it is very, very valuable to do that as a beginner because it helps you learn a shitload). Finally adding to this point, there's a cottage industry of people on Youtube who spend time pulling apart world-famous songs and figuring out who they're reusing for the bassline, what bands they sample parts of the audio segments from, etc. Hell, there's a whole browsable library of this: https://www.whosampled.com/
Separately, as a burned out folk+classical musician whose friends and family went on to be nationally recognized musicians (I dropped out of the folk scene due to gender dysphoria and presentation woes lol, but one family member did tour the world playing music when i was a wee bab), music has never, ever, ever been super profitable for anyone other than the very lucky or the very, very wealthy. You are very, very lucky to break even on the amount of time you spend, let along equipment costs. Even the internationally recognized composer John Cage had his main living selling mushrooms to Michelin star restaurants. Everything else I can say about this already has a really, really good write up about this here: https://klangmag.co/lifers-dayjobbers-and-the-independently-...
So between "You're unlikely to actually make money solely off music", "Professionals rarely write the entire piece themselves and will reuse things from other artists, either from a music library, a sample bank, or making their own samples", and "There's a whole slew of game developers out there that want real, human-made music, with all the soul and artistry that that entails", I don't really see a reason why this would take the wind out of anyone's sails.
But even if all of that wasn't the case, the question is ultimately: Why are you engaging in a hobby if it not being profitable, or you not being successful, causes you to lose any motivation? Why is that the main source of motivation for you, such that the possibility of losing that motivation causes you to lose all pleasure from the wonderful, unique experience of writing, composing, and performing music? I think this comes down to like, is your motivation for making music external, or internal. Does your joy of making something come from making the thing, expressing yourself and being artistic (ultimately being human in the process, because Art seems integral to us as a species, and engaging in it is stepping into and pushing forward this wonderful, complex history of self-expression), or some ephemeral possible future reward? Ultimately, it shouldn't matter whether or not you become a professional game musician (Which, by the way, is *absolutely* doable, and a worthy *goal* to have. I really hope you succeed!!), because the motivation to express yourself through a certain medium should ideally come from the joy you doing that and learning how to do it.
Essentially, it all comes back to the age-old, often stated: do you love learning because you love the idea of having knowledge at the end of it, or because you love the process itself. Learning to love the process is always, always going to be a stronger source of motivation and will last you through times when the progress and process are incredibly difficult.