Right know strapi doesn't handle this type of sorting and that would be very handy for use experience because if They can do this with fields, why not with relations?
Right know strapi already allow populate:{field:{count:true}}, but there isn't a straight forward way to add this very common functionality of ordering by count or sum.