mkdb: Prevent duplicate IDs in boxed union types

When registering a C union as a GBoxed type, Gtk-Doc generates
duplicate IDs. This handles the problem in the same way as structs
handle it.

Fixes bgo#669417.