I always joked that if you ask me to write a sort routine in the interview, I'm going to lecture you about why you need to go off the shelf, and doesn't Google have anyone who can make a shareable library? Do we really need to know how to code a lightning sort ad hoc? To sell more ads? heh
Then you wouldn't get hired. Former Google interviewer, 220+ interviews. I used to pretty frequently ask candidates to solve the following problem: write a program that loads lines of text from a file, shuffles them, and writes them back out again.
The reason companies like Google ask ridiculously academic questions in interviews (and that question is academic) is not because they're all ignoramuses who can't imagine anything outside their PhD box. It's because judging someone's technical and programming ability in under an hour any other way is really freaking hard. If you haven't done a lot of interviewing then it's easy to imagine, "If I were hiring, I'd only ask questions that REAL programmers would solve". But then you try lots of different kinds of questions and discover that for most of them, by the end of the interview you often have no real clue about whether the candidate can actually write a functioning program. CVs and qualifications are no help - they routinely seem to have no correlation with actual demonstrated skill.
Speed-coding whilst someone is watching you in a high pressure environment is difficult at the best of times. Doing it from scratch for any kind program of you're likely to actually write in the real job is impossible - nobody codes up a fully blown web app with the latest stack de jure (which Google doesn't use anyway) in 45 minutes. You don't even know what languages the candidate knows, in some cases, as not everyone thinks to put them on the CV. So you end up asking for a small, simple program that shows basic knowledge of basic language constructs like looping and different kinds of lists. Then there's time to write some code and ask questions about it. Additionally, there are multiple "off ramps" so even slow candidates don't feel like they are running out of time and panic, but faster candidates can keep being challenged with minor modifications to the task.
For what it's worth, if someone answered this question by writing a program that ran Collections.shuffle() or their chosen languages equivalent, that resulted in them being marked up not down, because you're right - knowledge of standard libraries is important and a good sign of experience. Then I'd ask them to do it again without using the standard library because I also want to see if they can write the code themselves. Using the most correct or optimal algorithm is not the goal, even if the question sounds algorithmic. It's just a scenario to get them doing things with data structures and basic control logic.
For what it's worth I am skeptical about the ages in the summary. If the average age at Google is 29 then that pretty much matches the average age across 25,000 developers on StackOverflow, which gave an answer of 30. However I suspect that the median age in engineering is higher if you take into account tech leads and technical management, and the age for the entire company is biased lower by the enormous ad sales organisation. That always seemed to me to be populated entirely by recent university grads. Selling ads is hardly exciting work with great potential for career advancement and doesn't require any specialist skills, so the people who do that tend to be young, and there have historically been massive numbers of them (like half the company).