Fixes validation of templateName when copying templates

This is relevant when copying a template of an application plugin and naming it the same way as a template of the relevant application which is also in the template group. In this case checking the packageID isn't sufficient since they are different (application <-> application plugin), but the applications also need to be checked.