permalink not showing correctly using wp_insert_post and post_name

AH!

https://permalinkmanager.pro/docs/tutorials/how-to-remove-numbers-2-3-appended-to-the-permalinks/

So the automatic slug creation of -2, -3, ..etc is done by core in order to make slugs unique. But I knew there was a way to change the permalink and not the slug. I just couldn’t find code anywhere to do this so I resorted to using this premium plugin.

global $permalink_manager_uris;
foreach( ... ):

$parent_args = array(
      'post_title' => wp_strip_all_tags($post_title),
      'post_name' => wp_unique_post_slug($post_title),
);    
$parent_post_id = wp_insert_post( $parent_args ); 

// Declare the custom URI for parent post
$permalink_manager_uris[$parent_post_id] = sanitize($post_title);

$i = 1;
foreach( ... ):

$child_args = array(
      'post_title' => wp_strip_all_tags($i),
      'post_name' => wp_unique_post_slug($i),
      'post_parent'  => $parent_post_id, 
);    
$child_post_id = wp_insert_post( $child_args );

// Declare the custom URI for child post
$permalink_manager_uris[$child_post_id] = sanitize($post_title)."https://wordpress.stackexchange.com/".$i;

$i++;

endforeach; //child


endforeach;//parent

update_option('permalink-manager-uris', $permalink_manager_uris);