Update post title with category name after editing a category

The solution I arrived at is using the POST value of the submitted category title, so you always get what you entered and not what was saved before. Like so:

function update_group($post_id) {

    $updates = array(
        'ID' => 996,
        'post_title' => sanitize_text_field($_POST['name'])
    );

    wp_update_post($updates);

}

add_filter('edit_category' , 'update_group' );