wp_insert_post if page doesn’t exist under current page

$args = array(
        'post_type'      => 'page',
        'posts_per_page' => -1,
        'post_parent'    => $post->ID,
);
    
 
$children= new WP_Query( $args );
 $seasonepisode = array(
            'post_title'    => $episodetitle,
            'post_content'  => 'Some Content',                     
            'post_status'   => 'publish',
            'post_parent'   => $post->ID,
            'post_type'     => 'page',
            'page_template' => 'template-songlist.php'
           );
if ( $children->have_posts() ){
    while ( $children->have_posts() ) { 
        $children->the_post();
        if(get_the_title() != $episodetitle){
           
            wp_insert_post($seasonepisode);
            exit;
         }
    }//end of while
}else{wp_insert_post($seasonepisode);}//end have posts
wp_reset_postdata(); 

Alternatively

$query = new WP_Query();
$all_wp_pages = $query->query(array('post_type' => 'page'));
 
//$assuimg $post is current page
    $children = get_page_children( $post->ID, $all_wp_pages );
$flag=true;
foreach($children as $child){
    if($episodetitle == get_the_title($child))
        $flag=false;
}
if($flag){
    wp_insert_post($seasonepisode);
}