As a fan of algorithmic problems and websites like leetcode, I'm totally fine with this kind of interview challenges, it's a good way to select candidates, and anyone can prepare for it
You could say, why not giving Sudokus, or chess boards challenges to candidates? It's not totally bad either, it's just further from the context
All this is not incompatible with knowing other engineering fields, networking, security, data structures, code patterns, which are indeed more useful in day-to-day work.
Students are often selected the same way in exams, which won't really matter in their future job/life if you look at their content. But the process matters, school teaches you to learn mostly, like those small logical/algorithmic challenges trains you to think, visualize, reflect on data and more