relaxes attachment-matching rules

It came as a surprise recently, but attachments.contains/get/update/remove
require the class of the payload to match the provided tag exactly, not
taking subclassing into account. This commit fixes the oversight.
Merge pull request #3845 from xeno-by/topic/attachment-subclassing

relaxes attachment-matching rules