I ran into this issue a few days ago and then did some testing. I added two new albums to my library (they are the same albums as the ones that are stuck as “undefined” in the web player) and waited for them to show up in the web player’s Albums section (yes, it takes some time before they appear in the web player).
Unfortunately, the old “undefined” albums were not overwritten, even though they are actually the same albums.
Then I deleted these newly added two albums in the web player, and they were also shown as “undefined.” However, after a while, the newly added two albums disappeared. This shows that although deleted albums may still temporarily appear as “undefined,” newly added albums can be deleted normally and will not get stuck in the library, nor will they remain visible only in the Apple Music web player.
I noticed that the album title is slightly different between Apple Music France and Apple Music U.S. Moreover, even in the U.S. Apple Music web player, it shows the title that is only used in the France region.
I moved to the U.S. and changed my Apple ID region 6yrs ago. These two albums that were stuck in my web player library happened to have been added before I switched regions. So I tried changing my Apple ID region back to France and subscribing to Apple Music for France. Interestingly, the moment the subscription was activated, the greyish “undefined” albums disappeared immediately. Now my web player no longer has these ghost, previously deleted albums.
It might be a possible explanation, and you could give it a try.
And you mentioned that you’ve never changed regions. In that case, there’s another possible explanation. Did you add self-made audio files to your library and sync them via iCloud? For some unknown reason, when deleting them, some cached data might have been left behind in the library.
I think you may need to turn off iCloud Music Library syncing on all of your devices, then use iTunes to create a new library and replace the old one—of course, assuming you back up your existing library first.
Hope this helps.