> With a copyright, people are allowed to do anything similar to you, so long as they do not derive their work from yours.
That is patently false for music - a songwriter's claim today that they never heard a slightly similar hook from 40 years ago generally doesn't hold in court.
The burden of proof of infringement is on the plaintiff in either case.
If you have an obscure patent nobody has ever heard of, you can win the suit by showing that the defendant had the same idea you did - you don't need to show their work derives from yours.
If you have an obscure song nobody has ever heard (or even an unpublished one!) you are going to have a difficult time proving infringement for a similar riff.
Perhaps you're most familiar with litigation around very famous songs, like the Under Pressure / Ice Ice famous case? In those cultural-saturation cases the court may make the assumption that the later party could have been exposed to the work of the earlier one, but that is not the case universally.
Harrison's song was "My Sweet Lord", the song allegedly infringed was "He's So Fine" by some girl group in the 1950s or 1960s. It shouldn't be hard to hear either one. My recollection is that the songs did some pretty much alike.
It's clearer than you think. Did Dua Lipa hear an obscure Florida reggae band's tune that isn't available on any major platform to listen to any more? It took some time, but eventually the court agreed she'd never heard the song she supposedly copied:
How is that different from a patent then? I don't think anyone would sue you for patent infringement against your hobby project. IP only typically becomes an issue when you want to make some money from your work, and then someone claims that it's actually their work, and thus should be their money.
That is patently false for music - a songwriter's claim today that they never heard a slightly similar hook from 40 years ago generally doesn't hold in court.