More than a few changes to get it to work:
FYI because I saw custom dimension changes in another PR... changing the ID of a custom dimension may break all existing custom reports that use such a dimension or a metric https://github.com/matomo-org/plugin-CustomDimensions/compare/pivot-by
Ready for review.
Looks pretty much fine, mostly concerned with
findReportMatchingParameters and making sure to not cause any problems with reports that cannot be found anymore. Eg around funnels, etc. As mentioned in the comment, not sure if that is needed?
Just tested it again and #13317 is fixed for me. 👍 (tested it with https://github.com/matomo-org/plugin-CustomDimensions/pull/100/files)
Before merging maybe also merge https://github.com/matomo-org/plugin-CustomDimensions/pull/100 and then update the submodule and fix the tests?