Interviews are largely broken today. People don’t write code in front of other people in real time in their jobs. They write it for an interpreter or compiler, and huge amounts of time and resources are spent building/maintaining development environments and pipelines. Trial and error is engrained into the normal workflow. It baffles me that a few minutes in a share notepad is commonly considered an accurate gauge for skill.
I think a much more accurate way is to discuss the role and candidate background and experience, and if theres a fit invite then to participate in code reviews and/or a small project.
Companies are cheap though, so they would rather do quick and crappy trivia interviews than something more time consuming and thorough.