<?php
$args = array(
    'taxonomy'   => 'category',
    'hide_empty' => 0,
    'parent'     => 0
);

$terms = get_terms( $args );
$i = 1;
$parentsArray = array();

echo '<ul class="tabs">';
foreach( $terms as $term ) { ?>
<li class="tab-link<?php echo $i === 1 ? ' current' : null; ?>" data-tab="tab-<?php echo esc_attr( $i ); ?>"><?php echo esc_html( $term->name ); ?></li>
    <?php
    $parentsArray[] = $term->term_id;
}
echo '</ul>';

for( $k = 0; $k < count( $terms ); $k++ ) { ?>
<div id="tab-<?php echo esc_attr( $k ); ?>" class="tab-content current">
<ul class="tabs">
            <?php
            $childArgs = array(
                'taxonomy'   => 'category',
                'hide_empty' => 0,
                'parent'     => $parentsArray[ $k ]
            );

            $childTerms = get_terms( $childArgs );

            foreach( $childTerms as $childTerm ) { ?>
<li class="tab-link current">
<a href="<?php echo esc_url( get_term_link( $childTerm->term_id ) ); ?>"><?php echo esc_html( $childTerm->name ); ?></a>
</li>
                <?php
            }
            ?>
</ul>
</div>
    <?php
}
?>