I agree and disagree.
If you have ample open source code, lots of experience that's relevant to what I'm doing, then gosh yes - nobody should be giving you homework to do.
To your point about only doing homework after you interview, look at it this way:
If you're unproven, then you're getting the homework because I don't trust resumes. I've seen college profs and career counselors tell people "If you've dabbled in it, put it on your resume." Combine that with people who don't have any code online because "I have a life outside of work" or "all my work is NDA", and I'm sorry - I need to see if you can do the job.
Look, I know it sucks to do homework as a candidate before you interview. You're taking 5 hours to do it. And I know it feels like a disrespect for your time.
But there are devs on the other side who are part of the interview process too. And for each candidate most companies interview, there's about 2 hours for every hour interview per person. Cos there's usually some kind of prebrief, the interview prep, the interview itself, then filling out scorecards and the debrief. That's a time investment too.
And if I'm interviewing tons of people, and then give them the homework, and it turns out they're great people but can't do the job we need them to do, then we wasted their time, got their hopes up, and wasted a lot of our time. Hiring people for a team is extra work. If I spent 3 hours in interviews today, guess what? I still have to get my work done too.
The argument against homework from the candidate always comes down to "Why should I have to prove I can do what I say I can do?"
Because that's what interviews are. And if you can demonstrate you can do what you say you can do, you'll make six figures sitting behind a computer screen in air conditioning.
Sounds like a sweet deal to me.