That largely is a case-by-case decision I think. Perhaps via open source work, perhaps via a short take-home assignment.
Since work in most of the US is “at will”, it’s an easy problem to solve if it turns out someone has exaggerated their abilities.
My problem is not with _any_ coding to be clear. It’s mostly the Google gotcha questions designed to make the interviewer look smart, and where the primary takeaway is that the candidate has or has not seen that question before.
Things like “let’s refactor this thing collaboratively and discuss trade offs” are fine - and discussing trade-offs gives you far more of a feel for a senior engineer than whether they can implement some trivially Googleable algorithm for which “use a library” is almost certainly the actual correct answer. This is the style of question I personally use when doing technical interviewing.