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


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(
            'description' => 'Slug: "'.$slug.'"',
            'slug'        => $slug,
            'parent'      => 25,

The function is called by an AJAX:

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

        var form = {
            action: 'test_submit_list',

        $.post(test_obj.ajax_url, form).always(function(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.