And, even when it is an X-Y problem, it may still be better to answer the question as asked, if only to then explain that maybe there is another problem that really needs to be solved.
Looking at it from a pedagogical lens, it seems some learners (question askers) will fixate on X and be unreceptive to Y, stemming perhaps from some fundamental differences in conceptual understanding between the asker and the answerer. Trying to answer for Y will confound and frustrate; closing the gaps in understanding (and there may be gaps on both sides) is usually a lot more involved than just shifting the conversation from X to Y.
Looking at it from a pedagogical lens, it seems some learners (question askers) will fixate on X and be unreceptive to Y, stemming perhaps from some fundamental differences in conceptual understanding between the asker and the answerer. Trying to answer for Y will confound and frustrate; closing the gaps in understanding (and there may be gaps on both sides) is usually a lot more involved than just shifting the conversation from X to Y.