Agreed.
My first question to any recruiter is now always "what's the salary range for this role?" precisely because I've run into your first point earlier in my career. I'm not even particularly salary-driven (doing interesting, valuable work is far more important!) but it's the best indicator that the role is pitched at the right level for me.
From an employer's point of view, there's also the avoidance of future unpleasantness if (or, rather, when) it comes to light that some staff are paid significantly less than their peers.
Responsible employers don't need mandatory salary disclosures to do the right thing here but, sadly, not all employers are responsible so this sets a common baseline and ensures everyone plays by the same rules.
> My first question to any recruiter is now always "what's the salary range for this role?"
The concept of range isn't useful to ask though. If you say my range is $x to $y, all the company hears is that you'll work for $x. The $y part is irrelevant. Learned this early in my career, where every "$x to $y" invariably became an offer for $x.
So now in my initial intro call with any recruiter I just tell them my minimum, fully knowing that becomes the maximum offer. If they're ok with that we can keep talking, if not, that's cool, we both avoided wasting time.