I've found you can somewhat mitigate it by asking questions yourself. For example in one tech screen once I had the algorithm pretty much done I asked if I should look to optimize and to add test cases/handle odd input and the interviewer said it's fine as is and let's talk more about other topics like architecture in the real world.
Absolutely, that's something I pointed out in my writing: if the interviewer doesn't explain their expectations, you can and should ask. Interviews work best when both parties are engaged heavily in the success of the interview.