When performing an import/restore, the course sections are displayed in any random order returned by the database, rather than being displayed in their actual sort order based on the course configuration/section order. This does not happen in all cases and is dependent on how the database orders the search and output of the results, so may not be replicable in many cases.
Adding the sort parameter to the database function call appears to solve this problem.