[FEATURE] Order package loading by dependencies
This change simply reorders the internal packages arrays
of the PackageManager in a way that if PackageA depends
on PackageB, PackageA comes later then PackageB when
iterating over those arrays.
This change does not introduce a sophisticated dependency
management, however it makes sure to be be able to load
configuration settings in the correct order.