Photometric redshifts for the next generation of deep radio continuum surveys - I. Template fitting