I picked up my first "real" (not a department store bike) mountain bike, a giant NRS XTC, in 2000. That bike cost me $1800 which I thought was outrageous. But, it was basically a top of the line giant at the time, complete with nearly the best components money could buy.
I rode it weekly for a decade on trails designed to destroy bikes. I replaced it with a lower mid-range trek superfly fs a couple years ago. That bike cost me nearly $4k. And besides the 29" upgrade (which makes it weigh more) I'm not convinced its actually a better bike. For sure, the more expensive versions (which were pushing $10k for the carbon versions) weren't a better ride.
So, I agree the prices for mountain bikes are ridiculous, especially if you don't buy into the idea that there has been a lot of technology progression since the late '90s early 20s. Most of the "progression" seems to be more style than substance. Take the recent axle/skewer fiasco. The general claim was that the skewer was a problem so it needed upgrading, but who has actually had a problem with them? Absolutely no one I know, has ever had a wheel come out of a front fork unless they failed to tighten it. Nor do I buy the idea that its more stable because the skewer wasn't providing any rigidity to the front fork, that was the job of the axle (which if you notice is the part that makes contact with the fork for all directional forces except laterally). In the lateral case fork manufactures were putting locking indentations in forks since the early 90's. Further unnecessarily changes, 27.5" wheels, nonstandard head tubes, etc.
The lack of _ANY_ competition in "local bike shop" sales channels due to franchise licenses and regional restrictions also serve to easily quadruple the prices too.
Bottom line is that I agree. Buy a used bike if you can. I'm pretty particular about size/fit so its harder for me, but people who are closer to average size don't really have an excuse.