Warning: Attempt to read property “term_id” on int – Woocommerce

You can I think you should use get_terms_args filter instead of get_terms and just add exclude arg, so now get_terms() function won’t retrieve those cats and you’ll get right count. Here’s code example:

add_filter( 'get_terms_args', 'mamaduka_edit_get_terms_args', 10, 2 );
/**
* Exclude product categories from Woocommerce
*
*/
function mamaduka_edit_get_terms_args( $args, $taxonomies ) {
 //print_r($taxonomies);
if ( is_admin() && 'product_cat' !== $taxonomies )
    return $args;

$args['exclude'] = [50, 22, 20, 31, 35, 45, 40, 65, 37, 40, 3434]; // Array of cat ids you want to exclude
return $args;
}