What file type are these files that are no longer in the library? It might say mp3, or m4a, or it might say Protected AAC Audio. And do you manually sync the music to your iPhone or did that just sync automatically?
From what it sounds like I can only guess that you are using the Apple Music subscription service where the files you have in your library are merely leant for the duration of the subscription (i.e. as long as you pay for it and as long as Apple retains the license to lend these albums to customers) and they come with DRM so they eventually expire if the subscription were to be terminated.
You should check on your iPhone under your iCloud settings (at the top where your name is shown) if you are still subscribed to Apple Music. You are probably using the Apple Music subscription to keep your iPhone in sync over Apple's servers (without having to sync the iPhone manually). The fact that the music disappeared from the iPhone as well is what makes me suspect that the subscription is either inactive now or was inactive for a short period of time...
There are enough reports here of users who had an issue with Apple's cloud services leading to their music library ending up in a mess and reports of all playlists having been suddenly deleted.
I suspect that all of the tracks I've downloaded from Apple Music are gone, and what's left are tracks I've ripped from CDs and/or acquired from other sources, but not sure.
I would assume that this is exactly what's going on.
Although there is something called "match" where Apple tries to match your local ripped music file with one on their servers (that is why you can sometimes end up with your ripped music being replaced by something entirely different when the matching goes wrong) in order to be able to sync it to other devices like your iPhone. In that case, Apple does not upload your ripped version and sync that to the iPhone, instead it tries to find a matching version they already got and then that's what will be synced to other devices.
Problem is that if the Apple Music subscription ever ends (or has an issue like perhaps here in your situation) then all these local ripped files are also no longer synced to other devices and if you don't have your own originals anymore then all that's left is Apple's version of it with the DRM on it and it becomes unplayable.
So I'd expect at a minimum that all 9000 songs are gone from the iPhone.
Any ideas or suggestions? Or am I just SOL?
Well, what you can always do is open the music app, then in the menu bar go to File, then Add To Library, and add the entire media folder. It will only import the missing items. Or drag the media folder into the main music app window.
But this will not reconstruct any additional library info like playlists or the play count or last played or date added. If you rely on that and simply adding these files as new ones isn't enough, then that's going to be harder to fix if it's even possible (I don't know since I don't subscribe to Apple Music and I have never seen this situation).