In pivot table, you have to sort table
first by first dimension
second by second dimension and
so when you are not expanding customer ID, the sorting looks OK
now when you are expanding CustomerID, the sorting is still OK.. but now every sub item of Customer ID is sorted by COUNT(OrderID).
so it's looks OK to me.
Update : Sort 2nd Dimension by Expression