Honestly, this feels like a bug with a custom template. If you are using a runpod template as a base, works fine, so it makes me suspect something about calling your openssh etc isn't being called properly. Can add some internal logs to validate.
Wouldn't make sense ssh just breaks down for a custom template but nothing else, cause I use a lot of custom templates too