Need to identify exactly the root cause, but apparently reverting the changes of XWIKI-20528 proves that the regression comes from there.