The template filter needs to be at the top level so the whole profile is excluded. Can't check since my lab is down, but isn't there a user tag that can be set in the profile, which then the template can filter to exclude any profile with it.
Setting a filter at the memory level in the resource tree will result in the template being applied to everything other than memory.