Custom rewrite for product variation not working

This works because on this URL, $_REQUEST['attribute_pa_model'] is set, and in this example, the value is iphone-x:

index.php?product=example&attribute_pa_model=iphone-x

But on this URL, $_REQUEST['attribute_pa_model'] is not set, so the auto-selection of the product variation does not work:

/product/example/iphone-x

So on that URL, you can use the woocommerce_dropdown_variation_attribute_options_args to filter the selected value, like so:

add_filter( 'woocommerce_dropdown_variation_attribute_options_args', 'auto_select_attribute_pa_model' );
function auto_select_attribute_pa_model( $args ) {
    // If it's not the pa_model taxonomy, don't filter the $args.
    if ( empty( $args['selected'] ) && 'pa_model' === $args['attribute'] ) {
        $args['selected'] = get_query_var( 'attribute_pa_model' );
    }

    return $args;
}

Additional Note

In my tests, this is not necessary and can be removed:

add_filter('woocommerce_taxonomy_args_pa_model', 'add_model_taxonomy_args' );