Possible to add a dynamic link to a sub-menu via wp_nav_menu_items?

The following code will go through all items and search the first item that has a parent. If found, new item with the same parent will be inserted as “first child”.

add_filter( 'wp_nav_menu_objects', 'se336857_dynamic_submenuitem', 20, 2 );
function se336857_dynamic_submenuitem( $items, $args )
{
    if ( !is_user_logged_in() || $args->theme_location != 'account-menu' )
        return $items;

    $parent = false;
    $current_user = wp_get_current_user();
    $url="/profile/" . strtolower(str_replace( ' ', '-', $current_user->user_login ));

    $item_profile = [
        'title' => __('Profile'),
        'url'   => home_url( $url ),
        'classes' => 'menu-item profile-link',
    ];
    $item_profile = (object)$item_profile;
    $item_profile = new WP_Post($item_profile);
    $i = -1;
    foreach ( $items as $item )
    {
        ++$i;
        if ( $item->menu_item_parent == 0 )
            continue;
        //
        // first submenu item
        $item_profile->menu_item_parent = $item->menu_item_parent;
        $new_items = [ $item_profile ];
        array_splice($items, $i, 0, $new_items );
        break;
    }
    return $items;
}