[TASK] Release typo3/ajax.php from early t3lib_div usage

ajax.php entry script requires t3lib_div very early to use a single
method from it. This is ugly, so the needed code is now implemented
in ajax.php directly, removing the requirement to include t3lib_div
so early.

Change-Id: I974c39c185872ab68bdc7732434c4bc52d77f75f
Resolves: #46269
Release: 6.1
Reviewed-on: https://review.typo3.org/18903
Reviewed-by: Christian Kuhn
Tested-by: Christian Kuhn