[BUGFIX] Scheduler throws fatal error while saving an Extbase Task

While improving the code coverage, some source code
had to be adjusted to be mockable. This unfortunetly
braught a regression into the Task class.

Releases: 6.1
Resolves: #47352
Change-Id: I7da54e882d7880c8a816a0b795fa55e53a542885
Reviewed-on: https://review.typo3.org/20115
Reviewed-by: Alexander Schnitzler
Tested-by: Alexander Schnitzler