Should I call a function to query the database in a custom content type template?
I believe that depends on what you're doing with your query. According to this Drupal.org community doc you should "refrain from having complex logic in" .tpl files and "for all the conditional logic and data processing of the output, there is the template.php file". IOW template files are for theming/output manipulation while other functions or logic should go into your custom module. So if your query is part of a theming process, yes it should be in your template file. Otherwise in your custom module. 

AFAIK other developers will not be looking for a non-theming function in a template, which is why I think the senior dev suggested that.