It's funny that the Ranger hasn't always even been an archery expert. In 2e and 3e, for example, the Ranger had a two-weapon fighting focus, with no ranged combat bonuses in sight! 4e let the Ranger focus on ranged or two-weapon fighting (or allowed you to be a switch hitter) rather easily. In 5e, the Ranger remains flexible, but not innately tied to a particular fighting style.
And yet, in the minds of players, Rangers are archery experts. This is in spite of the fact that one of the inspirations (if not the inspiration) for the class, Aragorn, is more of a sword guy (with Legolas being the archer- we'll come back to him), and of D&D's iconic Rangers, Drizzt only occasionally uses a bow!
So where did we get this Ranger = Archer from, anyways? It didn't come from nowhere- Hank the Ranger from the D&D cartoon exclusively uses a magic bow, for example. We can point to the fact that legendary archers tend to be also skilled in survival and woodcraft (and with more modern interpretations, they use firearms), because ranged weapons are good for hunting, something we expect the Ranger to excel at.
There's also Robin Hood, who, while more of a Fighter, has the outdoors and wilderness combat training that, again, we expect the Ranger to excel at. Legolas, again, due to being a Wood Elf, is "Ranger-coded" in the same way- he doesn't wear much armor, he obviously possesses superior woodcraft, etc. etc.. Take archery superheroes like Green Arrow and Hawkeye. Neither of these guys should be Rangers (though at least Arrow wears green, a tip of the cap to Robin Hood, and he did survive on a desert island so he has some skills).
I think this ultimately comes down to the lack of niche protection for the Ranger (not helped by the Ranger's innate identity crisis). Having the equivalent of SERE training is something anyone can have! Thus John Rambo is more Fighter than Ranger.
Something I've pointed out before is that not even the Ranger has been the best at these things, historically. The 1e Barbarian has the Ranger beat hands down when it comes to everything save Tracking. The 2e Ranger got wilderness stealth and remained the Tracking king (anyone could train the Proficiency, but it had an explicit carve-out in it's description of assessing a -5 penalty to non-Rangers). Meanwhile, while the Ranger got some bonuses, it was really the Druid that was presented as truly being one with the wilderness.
It's that last bit, the Druid's mastery over wood and wild, that got the Ranger it's "Druid flavoring" despite the classes having very little to do with one another (heck, the Bard was originally way more Druid flavored than the Ranger, wonder what happened there? Alan O' Dale must be turning in his grave!). Look how the two classes have been forced to split custody of animal companions, something that should be in the Ranger's wheelhouse (Tarzan, Grizzly Adams, The Beastmaster), and on occasion, the Ranger has even dabbled in shapeshifting!
The Ranger was given explicit supernatural abilities, mostly spells cribbed from the Druid, to give them a mystical connection to the wilderness to offset the fact that wilderness training is no longer class-locked.
And so we have the Ranger as a class not only without identity, but without any real purpose, as other classes can do what one would want it to do. You want to be Errol Flynn, master of bow and blade? Fighter. The right background, the right skills, bam. You want to be a ghost in the wilderness, darting in and out of the undergrowth like a 80's slasher villain? The Rogue can easily become the greatest guerilla fighter of all. You could effectively have an all-Ranger party where nobody even has the Ranger class!
It has become more efficient to build a Ranger as a single or multiclassed member of other classes than it's own class (nothing new, they noticed this back in 3.0, when Ranger became a dip for the Rogue class!). The only way to "save" the Ranger is by taking back the stuff others have gotten, or murder the Druid, since any attempt to give the Ranger unique non-magical abilities runs right into the D&D magic system where just about anything can be replicated with magic.
The Ranger is basically once of those archetypes that you know it when you see it, even if it's difficult to describe why something is or is not a Ranger. For something that is part of D&D's identity (well, at least since AD&D at least), something that, if removed from the game, would it feel like "something other than D&D", the actual Ranger feels vestigial. Like an appendix. Having an appendix makes one human, but if you have it removed, you're just fine without it.
I know a lot of people are going to disagree with my assessment here, but I don't say any of this as a "Ranger-hater". I like the archetype just fine. It's just, when I sit down to make a new character, nothing about the Ranger class makes me want to play one anymore. I can get my Ranger fix from any other class. In fact, many other classes have options within them that can make me seem more "Ranger-coded", in some way. Perhaps it's minor, like a Green Dragon Sorcerer. Or more concrete, like a Warlock with a Fey patron.
And I don't honestly know what could change that at this point, beyond niche protection that would feel arbitrary. The Ranger isn't the only class with these problems, but it stands out the most, as each other class has something that makes it unique.
What does the Ranger get? Stuff it shares with other classes, like Fighting Styles, Expertise, and what is Hunter's Mark if not bizzaro-Hex?