This logic doesn't apply to someone just starting out at age 37. Here there's a really easy explanation for why you're mediocre: you just started out. And I find myself viewing someone who, say, just got out of the military at 35 and is now trying to get a job as a programmer at 37 very differently than someone who has been writing CRUD-screen apps for 15 years.
I wonder if the reason why programming tends to be more ageist than many other professions is because learning new things is really a core part of the profession. An accountant can take their core skills and jump into any job, because the rules are basically the same everywhere. A Ruby-on-Rails dev can take their skills, but they will have to learn a good deal about the existing codebase to be productive regardless of whether it's using the same framework. So someone who shows they haven't learned anything new in 10 years is toxic in the software industry.