[TASK] Cleanup Ajax URL generation

The Ajax URL generation is cleaned up to
match the current state in TYPO3 master (6.2)

The compatibility for < 6.2 is still retained.

Related: #57096
Change-Id: I2f3e2e5080fa05eb7145133d7ff254911118d6ea
Reviewed-on: https://review.typo3.org/28651
Reviewed-by: Nico de Haen
Tested-by: Nico de Haen