Fix EZP-21758: Custom variables are not correctly exposed in legacy templates when doing a sub-request