Self-solved. Wrote two new functions in status_queues.php and added a call to SortStats in the existing processInterfaceQueues call:

processInterfaceQueues(SortStats($stats), 0, "");

Code is not so elegant and is not optimised but it works. Sharing for interest.

function SortStats_AppendCurrentAndContained(&$sorted_qname, &$raw_real_if_qlist, $qname, &$qdata, &$qcontains)
{
# Sort the list of child queue names and store back into the original 'contains' array
sort($qcontains);
$qdata['contains'] = $qcontains;
# Add the current qname (which 'contains' other queues) to the sorted_qname array first
$sorted_qname[$qname] = $qdata;
# Then add the contained queues, in sorted order
foreach ($qcontains as $qcontainedname)
{
# Retrieve the queue entry for the named queue
$qcontained = $raw_real_if_qlist[$qcontainedname];
# If it has a 'contains' array, recurse the addition of current & contained queues
if (is_array($qcontained['contains']))
{
SortStats_AppendCurrentAndContained($sorted_qname, $raw_real_if_qlist, $qcontainedname, $qcontained, $qcontained['contains']);
}
else
{
# Add the queue data for the named qcontained into the sorted_qname array
$sorted_qname[$qcontainedname] = $qcontained;
}
}
}
function SortStats($stats_to_sort)
{
foreach ($stats_to_sort['interfacestats'] as $raw_real_if_name => $raw_real_if_qlist)
{
$sorted_qname = array();
foreach ($raw_real_if_qlist as $qname => $qdata)
{
# If it has a 'contains' array, sort the children and build out the sorted_real_if_qlist
if (is_array($qdata['contains']))
{
# Append the current and contained queues
SortStats_AppendCurrentAndContained($sorted_qname, $raw_real_if_qlist, $qname, $qdata, $qdata['contains']);
}
}
# Assign the sorted array of queue names back to the raw_real_if_qlist
$stats_to_sort['interfacestats'][$raw_real_if_name] = $sorted_qname;
}
return $stats_to_sort;
}