Use the pivot table instead of a mapping on all found products (which does not
scale well at all when there are many products found).
On a test case of 10000 products and 300 categories (including parent/children),
testing the /shop page with a search:
- number of queries from 138 down to 128 queries,
- total request time from 0.55s down to 0.40s
- time of the changed line from 32% of the total request time down to 10%
PR: #34249