There’s no masters of a lot of rare, non-mainstream things, or at least not known masters. And a lot of great music that wasn’t going to be mainstream for a variety of reasons. Think regional funk, blues, punk, psych, etc. You just can’t get a great digital recording in many instances.
Another huge factor that affects the sound is the damned stylus. It's like switching speakers. Each one has its own signature. Then there's the phono preamp/RIAA filter too! I prefer our modern times where only the choice of speakers matters that much. Think of all the permutations of stylus, preamp, and speakers you had to consider in the early HiFi days.
It's called the RIAA equalization curve.
Basically when you master the record you put something down that has rolled off bass and lots of treble onto the vinyl LP. This is to encode the music in a form that is compatible with the physical disc + stylus.
https://en.wikipedia.org/wiki/RIAA_equalization
The preamp applies EQ to bring it back to normalcy.
The crappy CDs were a result of dumping a phono mastering onto a CD without realizing that a CD player was not going to apply the RIAA curve.
I don't believe this is the case. The RIAA curve is a very aggressive curve (40db) and no one would tolerate an uncorrected signal (plug your turntable into the line in for a taste, all you hear is sibilance). Also the filter would be applied by the person mastering the vinyl - it would not be applied before the master tape.
IMO the thin sounding CDs were because producers were used to vinyl which still has issues with bass even with the RIAA curve in place. Also because CDs were new and we lacked the knowledge and tools to use them to their potential. For example my teachers in college would have me turn in my DAT tapes with peak levels around -18db (late 90's).
I would guess that most of the time a CD made from the master tape sounds better than the vinyl even without a remaster. Of course the remaster is almost always the best bet.