[Refactoring] Add helper functions for TemplateTypeParameter deduction
fix Issue 11868 - ICE(template.c) on passing `inout const` argument as TemplateTupleParameter