You can use LanguageComparer to apply this ordering:
var sortedLangauges = currentItem.Database.GetLanguages.OrderBy((x => x),new LanguageComparer(currentItem.Database));
This is what the ContextEditor.SortLangauges setting uses behind the scenes.