[BUGFIX] Faulty expand/collapse behavior in Element Browser

On using the element browser in combination with files, the
expand/collapse behavior is wrong. On opening a collapsed folder,
an AJAX call fetches the sub-nodes that will be added to the DOM
tree. However, the calling scope of the original rendering
process and the AJAX call differ a lot.
The only possibility to get this working is to transfer the
scope and rebuild it in the AJAX context.

Change-Id: I1bf7b56ae2d82d15e0246bd651f77793adde705b
Fixes: #45859
Releases: 6.0, 6.1, 6.2
Reviewed-on: https://review.typo3.org/23877
Reviewed-by: Wouter Wolters
Tested-by: Wouter Wolters
Reviewed-by: Anja Leichsenring
Tested-by: Anja Leichsenring