There are five points I would like to raise for the question of, what to put in a template to ask better questions. The points include the workflows around the templates, and not just the template itself.
First, in UX design, you should tell people something three times. The purpose of the site should be a high priority for new users. The templates, the work flows, and the supporting pages should stress Stack Overflow is a site for Programming and Development questions. It should span multiple pages and be included in the template.
The Stack Overflow homepage and pages in the workflow must include the purpose of the site. This is an essential element in UX design. A number of Meta users rejected the UX requirement/best practice in the past.
Once a user becomes experienced enough, perhaps the proactive prompts and additional visual queues can be decreased or eliminated, much like ads are reduced over time as badges accumulate.
Second, folks need help when Stack Overflow is a bad fit for their question. In the absence of help finding the right site, some will dump it on Stack Overflow anyways. Perhaps the Data Analysis team can aggregate tags and some keywords from the question, and offer alternatives when it make sense based on the context.
For example, based on analysis, a final prompt like "Are you sure you want to post this to Stack Overflow? Stack Overflow is a site for Programming and Development questions, and your question might be a better fit on Super User or Unix & Linux Stack Exchange"
Third, please check the HTTP referrer header and use the referrer as a data point. When warranted the site should increase UX awareness and visual queues, like the purpose of the Stack Overflow site and confirmation prompts before posting.
Google and Microsoft self-help pages send people to the Stack Exchange network for support rather than supporting the products themselves. That explains why we get so many questions like "how do I SSH into {Google Compute|Amazon|Azure|<favorite storage>}". In fact, some users argue Google and Microsoft tell them to ask on Stack Overflow.
In fairness, Google and Microsoft offer choices in self-help. But Stack Overflow has brand recognition like Apple and Coca-Cola, so folks flock to Stack Overflow.
Fourth, maybe there should be an Answer template in addition to question templates. New users post answers to anything they think they can answer, and they don't realize they are encouraging more off-topic posts.
Ironically, I also find high reputation users willing to answer off-topic questions, too. I regularly observe users with 40K or 160K answering off-topic questions. It brings about some amusing defenses from high reputation users, like copying/pasting a command in a terminal is programming the terminal. (I've been guilty of this as well).
Fifth, some tags seem like they attract more off-topic posts than others. For example, Linux and SSH attract a lot of off-topic questions. The workflows should take tag history as a data point and increase UX awareness and visual queues, like confirmation prompts before posting.
I kind of hesitate to point this out because its kind of obvious... The Stack Exchange network has a User Experience Stack Exchange. Instead of relying on votes from non-experts (like computer programmers), maybe it would be a good idea to include the UX experts (the folks on UX.SE) in this process. The UX experts could likely offer insights and suggestions a typical site user lacks.