Resampling does not lead to any perceptible quality loss, but encoding to aac with libavcodec’s encoder (as YouTube does) definitely will. At the very least, it cuts all frequencies above 15 kHz which are potentially audible. Opus does not, and 128k opus is usually considered transparent.
I can’t find it but somewhere there’s a very detailed explanation from Monty himself about it
This would not be the default behavior of yt-dlp. Run
yt-dlp -vF <video>
to view the sort order used. Acodec should come before abr.It used to be the behavior of the original youtube-dl, however.