The digital source material is a limiting factor for achievable quality, but so is the DAC that is to translate the source material. Some cheap DACs are not meant to translate specific bit depths and sampling rate, some supply the jack with less output power, some exhibit more crosstalk, some have more limited frequency responses. So yes, second to the source material, it's the DAC that is the limiting factor for good sound.
It's the speakers that is the limiting factor, by an extremely wide margin.
A cheap DAC can produce around 16 bits and 20 kHz. It's not difficult. A pair of $10 earplugs is much more limited in what sound it can physically play.
It actually isn’t that easy, like at all. A tiny DAC in a phone amplified to loudspeaker levels is going to sound qualitatively different from a stronger signal out of something built to that spec. Not to mention interference issues in analog signals at low power.
3.5mm is de facto hi-fi.