How to sort categories by id in wordpress admin

The following should work…

add_action('get_terms_args','my_order_cats',10,2);
function my_order_cats($args,$taxonomies){
    //Check we are admin side
    if(is_admin()){
        $taxonomy = $taxonomies[0]; 
        $screen = get_current_screen();
        //Check screen ID and taxonomy and changes $args where appropriate. 
        if(($screen->id=='edit-category'||$screen->id=='post') && $taxonomy=='category'){
            $args['orderby']='id'; //preserves order of subcategories.
            $args['order']='asc'; //or desc
        }
    }
    return $args;
}

It preserves the order of subcategories (i.e. children always appear below their parents regarldless if order is set to ASC/DESC).

This could be adapted for custom taxonomies, you would simply need to chhange the $screen->ID and $taxonomy checks.