In my experience, these sort of tests do often seem to be used by the more interesting, more competent kind of companies. The first company where I encountered this (14 years ago), had only highly competent developers, many of them committers to various open source projects. About the recent one where I wrote a customised version of A* (because of the presence of wormholes, which made it not remotely rote for me or for most people, I'd expect), I of course don't know how it would have turned out had I taken the job, but if they select for this kind of thinking, I see that as a very positive signal about the kind of work they do and the kind of people they hire.
At companies that didn't have this kind of test, the quality of their developers was a lot more hit-and-miss.
At least for permanent employees; I've never encountered this for freelancers.