[BUGFIX] Backup singletons in unit tests prior to other setUp operations

If the singleton management is changed in unit tests, a local copy of
the previous stage is done to re-construct this state in tearDown().
This has to be done before any other instantiation in setUp() is
initiated which might register additional singletons.

Resolves: #50812
Releases: 6.2, 6.1, 6.0
Change-Id: I7788a5788aca6777040b777aeceb0558f96022b2
Reviewed-on: https://review.typo3.org/22899
Reviewed-by: Christian Kuhn
Tested-by: Christian Kuhn