This is largely because MP3 is a crappy, old format. Try high-bitrate Opus on most samples and you're a lot less likely to get above-chance results on an ABX test, pretty much ever, at high bitrates.
Ultimately though, lossy compression is always program-dependent ("program" here means the song, not the app). The encoders use psychoacoustic algorithms, and there is no way to prove they will perform well on all samples. So you will always be able to find corner cases where an encoder or format does worse and results in more audible artifacts; some of these might be encoder bugs, some might not. Therefore, it is fair to say that you might not want to rely on lossy compression for archival. But it is perfectly reasonable to use it to put music on devices to actually listen to.
You say good mastering makes it easier to notice encoding artifacts, but actually, bad mastering can do that too. Over-compressed stuff (in dynamic range) with inter-sample peaks above 0dB can clip and distort after getting run through a lossy codec.
As for lossless formats, though, anything above 48kHz 16 bits is complete nonsense for final delivery to consumers. All the "high resolution" stuff with higher sample rates and bit depths is just marketing bullshit, and this has been repeatedly demonstrated in trials (the well-designed ones anyway; there are plenty of terrible ones - no, comparing the 96kHz download to the 48kHz download of a song is not how you test this properly).
Bit depths above 16 are useful during production (because quantization noise accumulates and is boosted by things like dynamic range compression); in practice you want to record at 24 bits for headroom reasons, and process in 32-bit float because there's no reason not to with modern computers (and many practical advantages, e.g. ~infinite dynamic range). Sample rates above 48kHz are less so; the main reason to use them is to avoid aliasing artifacts, but it is usually much more effective to do that with well-designed DSP algorithms that include internal oversampling, as opposed to just doing everything at a higher sample rate. Unless you're doing extreme pitch shifting; then higher sample rates may make sense.
Videos everyone interested in audio production should watch:
https://xiph.org/video/vid2.shtml
https://www.youtube.com/watch?v=-jCwIsT0X8M
The little tidbit at the end of the second video about how 48kHz is, in some respects, twice as good as 44.1kHz, is quite neat and not something I'd realized before.