It's not that stupid from company's point of view - they're preselecting for people who really want the job, and have enough energy to pursue it. These are the people you want to for your company.
Strange that this only seems to be necessary in the software industry while literally every other industry seems to be getting along fine without these dehumanizing interview processes.
I think to the fact that other "engineering" industries do have licenses. There is no way legally they could get away with these types of interviews.
I used to be a software developer and an architectural firm (that designs buildings). The architects plus engineers had to go through 5 years of college, do years of on job training, all before they can be licensed.
I felt kind of bad for them though because I made more then most of them before I was 21.
The interviews are crazy though. The last big company I worked at had a "probation" period. For Sr Software Engineers we would only do a single 1 hour interview. But if they did not do well in the first 90 days we could fire them.
Seems much better than telling people to study leetcode hours per day for 2 months prior to an interview.