tags: fix and improve registration of elements

This primarily fixes the exception caused by multiple keys in map when
a page has several tags with the same parent (`second` in the test
suite). While at it, warn about non-redundant keys, and allow explicit
override of implicit keys, and allow up to (almost) 257 elements to
share the same key.