For example, a very common case on Stack Overflow is a question asking how to achieve a specific task that many libraries have already been written to fulfill. If the answers it tends to invite are mostly links to those libraries outlining why the answerer recommends them, is the question still considered acceptable?
The fact that someone has posted an answer that utilizes a library doesn't really have any bearing either way on whether or not the quesiton is acceptable. It might be acceptable, or it might not be.
This is sometimes a red flag that the question might be Too Broad, if it takes a library to be able to complete the task, but the fact that it's possible to answer a question using a library doesn't mean the question is necessarily bad.
You also seem to be assuming that posting an answer that uses a library is somehow "out of scope" for the question. That's just not the case. It's not "out of scope" to solve a problem using a library, unless the question specifically states that it's not appropriate to use a library. If there is such a restriction in the question then the answer is out of scope, and that would mean that there's a problem with the answer in that case, not the question.
If so, then what about questions that are phrased to fit the scope, but intentionally (possibly even underhandedly), invite answers of this nature? Should they be voted closed anyway?
Are you asking if you should you vote to close questions that infer that they want answers to more than just answer the question, but to also do something else? This doesn't really make sense.
I guess the first thing to ask yourself is if the question they're inferring is actually an appropriate question. If it is, it sounds like the question would be improved by simply making the inferred question explicit, rather than inferring it. If it wouldn't be, then I'd be inclined to simply edit out the inference, and leave the actual literal question, assuming it's an appropriate question.