Testing for geekyness and ability to solve tricky coding math problems, seems like a rational way to do that.
If companies were starving for talent because 'nobody could pass the test' - it would be another thing.
But they have to set the bar on something, somewhere.
I can't speak to AI/ML but I would imagine it might be hard to hire there, given the very deep and broad concepts, alongside grungy engineering.
I've rarely had such fascination and interest in a field that I would never actually want to work in.