2nd aspect is unpaid take homes. It's complicated. Companies do pay a lot to fly candidates, put them in hotels and feed them for onsite interview. So financially company can afford to pay something. But it adds a moral hazard as you are paying cash irrespective of any expected quality or commitment.
Other thing I would like to highlight is that unlike any other industry, tech. allows people to enter at ease irrespective of the pedigree and credentials. No hospital would hire a physician who has read a lot on the Internet and did some pro-bono help to the neighbourhood kids. So what is the best way to hire isn't very well defined. It could be Leetcode, puzzle problems, take home tests or something else.