Thinking like an engineer, from the companies perspective, its just a filter. While it could be the case that candidate A who passes the coding interview makes a terrible employee, while candidate B who does not pass the interview would make a better one, it doesn't matter. As long as the pool of candidates who pass the coding interview, fares better than the pool who does not, it will be a useful tool until someone…
The goal is to view people as different "grades" like a commodity. They aren't measuring directly for skill, instead they're measuring for the odds you match a some "grade" of software developer.
To your point, if memorizing the first 1k digits of pi correlated with a higher "grade", then companies would use that instead.