These kind of coding questions aren't about the interviewee's "problem solving" skills. It's purely a question of basic competence in the field. If it's general problem solving capability you're after, then you're right, there are much better ways to do that. In the case where a job interview involves multiple one-on-one interviews, it might make sense to have one interviewer focus on basic competence, and another interviewer to focus more on more general problem solving skills.
You might think we ought to be able to assume a basic level of competence, but lots of people in the industry think you can't. And to the extent that you can, that's often because the person sitting in front of you in an interview had to get through an initial online screen where they had to do some sort of coding exercise.