I suspect that PHP considers the value of $wpdb->get_row("SELECT * FROM wp_posts WHERE post_title="" . $title . """, 'ARRAY_A');
to be true no matter what (see also this). You’ll have to count the number of rows that are returned
Try something like this instead:
$query = "SELECT COUNT(*) FROM wp_posts WHERE post_title="$title"";
$count = $wpdb->get_var($query);
return $count > 0;