issue #22244: refactor document associations

Not ready for pull yet

TODO: need a compound inverse in case of duplicate source key

resolves #1962.
This raises name-collision and -duplication issues. We should provide guidance somewhere. If not, there will be problems with extensions - ours and 3rd party - using the same property names for different document types. There also might be multiple extensions using different property names to form associations with the _same_ document types.