Note: When closing this ticket, if we go through with the solution proposed on the PR so far, we need to open a ticket for https://github.com/xwiki/xwiki-platform/pull/4960#discussion_r2631787638