Shortcode not work in picture source srcset tag

i fix this with a new shortcode that generates the entire tag. Like this:

function generate_image_tag($atts) {
    $atts = shortcode_atts( array(
        'img' => '',
        'title' => '',
        'theme_url' => get_bloginfo('template_url'),
    ), $atts );
    
    //File path details
    $file_info = pathinfo($atts['img']);
    $file_dir = $file_info['dirname'] != '.' ? $file_info['dirname']."https://wordpress.stackexchange.com/" : '';
    $file_url = $file_dir . $file_info['filename'];
    
    $output="<picture>
                <source srcset="".$atts['theme_url'].'/images/'.$file_url.'.webp" type="image/webp">
                <img src="'.$atts['theme_url'].'/images/'.$atts['img'].'">
            </picture>';
    
    return $output;
}
add_shortcode('generate_image', 'generate_image_tag');


[generate_image img="image.png" title="Title"]

I think maybe something in WP is wrong, and its a bug. None shortcode works in <source> tag. Regards! 🙂