[BUGFIX] Include RSA JS files in HTML header

Due to an oddity in page renderer, we cannot
add the required JavaScript to the footer
as it would not be rendered.

Clean up the JavaScript to correctly work even
when included in the header and change the hook
to add the JS files to the header.

Resolves: #58010
Related: #57294
Releases: 6.2
Change-Id: I354de3b0aeaf2b163b5df5301de6f0a0aaae34a6
Reviewed-on: https://review.typo3.org/29581
Reviewed-by: Oliver Klee
Tested-by: Dirk Klimpel
Reviewed-by: Markus Klein
Tested-by: Markus Klein