I recently discovered that deleting a song from my music library on either my iPhone 15 Pro or my Macbook Pro will also cause it to "disappear" from my list of purchased songs, making it difficult to redownload them as described on this page. I put "disappear" in quotes because I can still see the purchases in my history on reportaproblem.apple.com, or by viewing my purchase history in the Music app on MacOS in the Account menu (Account > Account Settings... > Purchase History > See All), but they don't show up in Account > Purchased, which is the only way to redownload them.
If I go to the iTunes store on my laptop, it looks like I haven't purchased them (the "buy" button has the price listed instead of saying "purchased", but when I try to "re-buy" them I get a popup saying I've already purchased it. Luckily that popup does have a download button so I can actually get the songs back, but it's annoying having to do that.
On the iPhone, however, no such luck. Not only do the deleted songs not show up in my purchased list in the iTunes store app, if I search for them in the store they show up as if I've purchased them, with the price button saying "purchased", and tapping that button does nothing. The only way to get them back is to re-sync to my laptop.
I've made sure that all the songs I'm looking at were bought with the same Apple ID that both my phone and laptop are signed into (I even bought a new song just now as a test just to make sure). Any ideas what's going on?