I'd take this a step further and make each species-gender a collapsible/expandable category, like the Stocks screen. So at first you'd just see "8 male cats," "5 female horses" and so on.
The way the stocks screen is arranged[1], it'd be categorised as something like "Equine", "Ungulates", "Canine", "Primates", etc, then within the list (as expadned by <tab>) the creatures grouped in sub-type order (horse, mule, etc). Possibly the marked-for-butchering ones get appended to the end by a different colour(like dump/forbid, and maybe melt, in the Stocks list).
If the stocks menu is being redone for greater control[2], then it could be done so that the the animals could be similarly sorted. Your choice of gender/pet-or-butcher-statuses/animal families (and subtypes within).
But, for now, a hard-coded sorting by animal-type, then gender (or age) within, then age (or gender) within, and possibly pet-at-top-and-butcher-at-bottom either as the final sub-sort or at the first level... Should be simple. (Noting that I may be a coder in a number of languages, but I haven't had any opportunity to look at Toady's code, so I'm just going on the general principle, not the reality. Nor am I accounting for Toady's priorities or own thoughts on this matter, of course.)
[1] It needn't be, but it the possible savings of time by re-using/adapting the existing code
could make it easier to implement, and thus more likely.
[2] Multiple levels of expansion, and/or possibly choice of groupings so that all plant fibre footwear can sit together
then whether they are socks or shoes, as opposed to being grouped as socks or shoes and then plant or silk (or leather, for shoes) within that as per present... and be able to supercede the (decreasing) value order within that by any other choice...