[FEATURE] Introduce methods to detect TYPO3_MODE properly

Currently a lot of conditions exist that directly
check for TYPO3_MODE to be "FE" or "BE". When it
comes to unit test this is pretty bad as constants
cannot be mocked at all.

Therefore this patch introduces two methods in the
ExtensionService to detect if the plugin is running
in frontend or backend mode.

Releases: 6.1
Resolves: #46391
Change-Id: I7367cda467ac2a421e0f8d6d25dd2209f939b99b
Reviewed-on: https://review.typo3.org/18995
Reviewed-by: Christian Kuhn
Tested-by: Christian Kuhn
Reviewed-by: Mattias Nilsson
Tested-by: Mattias Nilsson
Reviewed-by: Alexander Schnitzler
Tested-by: Alexander Schnitzler