>you get lucky and they happen to ask the questions you’ve just brushed up on or you get lucky and see the answer quickly for some reason
My experience exactly! I've been lucky in most of my interviews that I was asked about things I just happened to brush up on or had thought about deeply in some past project, so I was offered the job.
And like you say, the job rarely demanded any of the things I was asked about... which worked against me once, where I sailed through the interview process but struggled for the first year to get up to speed in my actual day-to-day job, although I did manage to get my act together before it became a big problem.
Yup! To be honest, it should be obvious via someone’s resume and references whether they’ll be capable of adapting to the job without making them jump through random hoops. People treat hiring devs like they’re hiring a contractor to paint their bathroom, instead of hiring them like white collar professionals who will grow with a position.