Are these people really trying to be disingenuous or does the question missing context? Often asking for the really problem reveals more information and allows the answerer to be more helpful
The problem is that the XY Problem is a classic beginner mistake and most SO questions are beginners who didn’t even consider Y, so maybe 1% of the time it doesn’t apply. And to those people, it is helpful to explain why you are stuck with X as it will likely clarify context that will help people answer your question.
Have you ever scrolled through Stack Overflow's new-question queue? It's quite easy to separate not just beginners from advanced users but also beginners who have done their research from beginners who have put less effort into their question than you put into reading it.
Maybe it seems rude or condescending to address a poorly formed question, but I'm not sure what else you can do since you have to realize that low effort questions also have a cost.
For example, have you ever tried helping someone where you have to ask a 20 questions just to glean enough info just to help them? You can see this on SO all the time.
Sure you can, beginners never research their questions and they don't give the right context.
Beginner question: "How to make a webserver using bash?".
Non-beginner question: "How to make a webserver using bash? I have this weird embedded system and it is missing SDK, http daemons or programming languages, but somehow comes with coreutils and fully-featured bash 5.0.17. And I really need to serve a single static webpage off it"
The first question will get X-Y answers like "here is how to install apache" and "you probably want to make CGI script instead, here is how you do it". The second one will get the interesting answers.
Stating from the get-go that the choice of X is beyond your control would help though, assuming that you’re already aware that you wouldn’t have the problem if you’d use Y instead of X.