[BUGFIX] Inefficient cache handling in LocalizationFactory

Calling has() in front of get() is inefficient and can be optimized.

Change-Id: Id8048023cc2305534a494664b402d47911087db6
Fixes: #47184
Releases: 6.1, 6.0
Reviewed-on: https://review.typo3.org/19911
Reviewed-by: Wouter Wolters
Tested-by: Wouter Wolters
Reviewed-by: Marc Bastian Heinrichs
Tested-by: Marc Bastian Heinrichs
Reviewed-by: Christian Kuhn
Tested-by: Christian Kuhn