You're going to need to loop over the $re_child_terms
array. According the docs get_term_children returns an array of term_ids so you will need to loop over the ids, get the terms and save them into a new array if they're not empty.
$re_child_term_ids = get_term_children( $term->term_id, 'category' );
$re_child_terms = array();
foreach ( $re_child_terms_ids as $child_id ) {
$child = get_term($child_id);
if ( is_object($child) && !($child instanceof WP_Error) ) {
if ( $child->count > 0 ) {
$re_child_terms[] = $child;
}
}
}
if ( $term->count > 0 || !empty($re_child_terms) ) {
// do stuff
}
// note: this code is untested but should work
EDIT (encapsulated into a function):
// in functions.php
if ( ! function_exists ) {
function get_nonempty_term_children( $term_id, $taxonomy ) {
$child_ids = get_term_children( $term_id, $taxonomy );
$child_objs = array();
foreach ($child_ids as $id) {
$child = get_term($id);
if ( is_object($child) && !($child instanceof WP_Error) ) {
if ( $child->count > 0 ) {
$child_objs[] = $child;
}
}
}
return $child_objs;
}
}
// in template
$re_child_terms = get_nonempty_term_children($term->term_id, 'category');
if ( $term->count > 0 || !empty($re_child_terms) ) {
// do stuff
}