[TASK] Extract package dependency sorting to separate class

The Package Manager got pretty big due to the custom
dependency resolving algorithm of CMS. Further the
algorithm relied upon the presence of package objects
which might not be fully present yet during bootstrapping.

This patch extracts the dependency handling from the
Package Manager and adapts it to work only on the
package states configuration.

Resolves: #55404
Releases: 6.2
Change-Id: I00e7a3769378b48bd3f3c285ea2b3c6d824dd061
Reviewed-on: https://review.typo3.org/27101
Tested-by: Thomas Maroschik
Reviewed-by: Markus Klein
Reviewed-by: Stefan Neufeind
Tested-by: Stefan Neufeind