insert term array with wp_insert_term

I want to import one or more categories using the input checkbox. But I do not know how to compare the array with the checkbox.
When I use only wp_insert_term after sending the form and enter the values manually, no category is added.
My initial code is below.

<?php
if (isset($_POST('product_send')) && !empty($_POST('product_send')) && $_POST('product_send') == 'send') {
    $taxonomy = 'product_cat';
    $related_terms = array(
        'tv' => array('samsung', 'lg', 'xvision'),
        'cellphone' => array('apple', 'samsung', 'xiaomi'),
        'monitor' => array('samsung', 'lg', 'hp'),
        'laptop' => array('hp', 'sony', 'lg'),
    );
    foreach ($related_terms as $key => $term) {
        wp_insert_term($key, $taxonomy);
        $parent_term = term_exists($key, $taxonomy);
        $term_id = $parent_term('term_id');
        foreach ($term as $term_value) {
            wp_insert_term($term_value, $taxonomy, array(
                    'parent' => $term_id
                )
            );
        }
    }
}
function product_menu()
{
    add_submenu_page('edit.php?post_type=myproduct', 'import product', 'import product', 'administrator', 'my_product', 'product_page');
}
add_action('admin_menu', 'product_menu');
function product_page()
{
    ?>
    <div id="wpbody" role="main">
        <div id="wpbody-content">
            <div class="wrap">
                <form method="post" action="">
                    <label><input type="checkbox" name="product()" value="tv">tv</label>
                    <label><input type="checkbox" name="product()" value="cellphone">cellphone</label>
                    <label><input type="checkbox" name="product()" value="laptop">laptop</label>
                    <input type="hidden" name="product_send" value="send">
                    <input type="submit" class="button-primary" value="send">
                </form>
            </div>
        </div>
    </div>
    <?php
}?>

Why does wp_insert_term insert 2 terms when using dynamic slug

I’d like to dynamically generate the slug for a term. But I always end up with 2 entries in the database.

I came up this minimal working example:
When I run this code below, I end up with 2 entries in the database

e.g.

term_id  name   slug  
284      test   list-66603_1610659731  
285      test   list-29853_1610659732
function test_submit_list()
{
    $slug = 'list-'. random_int(1,100000) .'_'. time();

    $term = wp_insert_term(
        'test',
        'list',
        array(
            'description' => 'Slug: "'.$slug.'"',
            'slug'        => $slug,
            'parent'      => 25,
            )
    );
}

The function is called by an AJAX:

$("#list-form").on('submit', function(e) {
        e.preventDefault();

        var form = {
            action: 'test_submit_list',
        };

        $.post(test_obj.ajax_url, form).always(function(data) {
            console.log(data);
        });
    });


When I change the first line to $slug = 'list-'. 12345 .'_'. 11111111;, I only get one entry.

Can someone please explain to me what is going on? This is driving me crazy.