If the solution passes some objective criteria that we have, it then forms a significant component of the on site interview where we discuss their solution in depth and have them talk about the decisions they made and opportunities for improvement. Not only does this allow us to ensure that they actually wrote the submitted solution but it gives the candidate the chance to speak from a position of authority on their own code.
But really most importantly, it is important for reviewer to be prepared for things like performance anxiety, like shy people who are not good at looking confident, to people cant think out loud (don't hold it against them if they are silent for few minutes for christ sake) and so on and so forth.
But people here throw temper tamtrum over really simple well known questions.
Maybe the companies would to the best if they made their expectations clear and realistic in ad itself. Let people know how interview looks like before hand, let them know what exactly it is you expect and then stick to it.
I have no problem working 2-3 hours on an assignment to demonstrate my knowledge. Those at least seem more realistic than some of the interview questions about the most nuanced aspects of programming.
I know of three possible ways to evaluate coding ability:
1. Ask coding questions in interviews. This is biased against people with performance anxiety.
2. Give people take-home "work samples". This uses up more of a candidate's time, and it may filter out high performers with multiple offers. Plus, if you give anything that takes more than a few hours, it really ought to be paid.
3. Ask for a GitHub profile with open source contributions. This is biased against people who leave work at work, or whose previous employers don't contribute to open source projects.
It's been a few years since I last interviewed candidates, but if I were designing the interview process, I'd probably want at least one of the above before hiring a candidate. Maybe the candidate could choose? "If you have public open source contributions, please submit a link and a description. If you don't, no worries! We'll can do a coding test instead."