…Even exactly same album could have different loudness depending on where was it published (in vinyl era). We are talking about “production“… and it’s going to happen always.
Going back to OP question: yes, YT is louder frequently. But I find Apple Music loud enough, with earbuds from my iPhone. My iPad Pro 10.5” can go a little louder with same AM, though.
To get the highest volume you should choose low impedance earphones (32ohm or similar); if you plug high-impedance (600ohm…) earphones, YES, music could sound intolerably low!
Add to this what I suppose it’s well known: check that volume for earphones is not “limited”, in a specific setting in iOS (aimed at children protection); check “auto-leveling volume” in “Music” app (it tends to adjust every playing session down to lowest song volume. YT doesn’t do it, by the way! If they would -automatic leveling-, they’d do the same).
I like to go 11 in my desktop amp, and I prefer well produced music (no artificially pumped up) and just turn up the volume knob. Some users want more db’s from a phone, I presume. I understand why portable earphones amps and portable digital audio players are a thing (I use a DAP also, and, YES, “10” it’s much louder than in phones).