Add a second role when registering programmatically

You could use the register_new_user hook which fires after the registration is complete. e.g.

function add_role_to_new_user( $user_id ) {
    $new_user = get_userdata( $user_id );
    if ( $new_user ) {
        $new_user->add_role( 'a_second_role' );
    }
}
add_filter( 'register_new_user', 'add_role_to_new_user' );

This will – I think – fire for all new users, including new administrators added in the dashboard. If that’s not what you want then you can add a check e.g. in_array( 'subscriber', $new_user->roles, true ) first before adding the new role.