When using $template->create() to get a template (for example in the templates hook listener), if the template isn't preloaded it will generate a query to fetch the template (assuming the templates are not saved as files).
In this case, the query count in the footer seems not to include the above query into the total. When looking in the debug page, it does show the correct amount of queries.
In this case, the query count in the footer seems not to include the above query into the total. When looking in the debug page, it does show the correct amount of queries.