I don't think its wrong to do these types of interviews. But interview stress is real, and it affects people in strange ways. I bombed one of these interviews once and the interviewer was convinced I was "not a front-end programmer". I had just left a job where I had written literally hundreds of thousands of lines of (modern) front-end code, daily, for the last several years. More complex than what I'd be writing at that company (I was eventually hired in spite of this particular interview). And oddest of all, that interviewer was (very soon after) let go. Such is the world of programming interviews.
So yeah. I don't think its necessarily the worst. It might even be the best way to interview candidates. But we all need to take our asessemtns with a huge grain of salt and stop being so judgemental.
reality is there are just a lot of people who can't really code -- IN THE ARTIFICIAL CONTEXT OF AN INTERVIEW - out there.
FIFY.