Site icon Hip-Hop Website Design and Development

customizer refresh doesnt reflect values

brand new wordpress install, removed default: plugins, posts, pages and the additional themes other than twenty twenty-one.
(this way pretty much anyone can reproduce the issue)
created and activated a minimal child theme where style.css has only this:

/**
Theme Name: Twenty Twenty-One child
Template: twentytwentyone
*/

and functions.php has only this:

<?php
add_action( 'customize_register' , function($wp_customize){
    $wp_customize->add_setting('my_setting',array(
        'type'      => 'theme_mod',
        'transport' => 'refresh',
        'default'   => false
    ));
    $wp_customize->add_section('my_section',array(
        'title' => 'foo'
    ));
    $wp_customize->add_control('my_setting',array(
        'label' => 'enable/disable parking page',
        'type'  => 'checkbox',
        'section' => 'my_section'
    ));
});
add_action('template_redirect',function(){
    if(get_theme_mod('my_setting',false)){
        echo 'hello am a parking page';
        wp_die();
    }
});
?>

when I goto customise foo section and tick the checkbox, nothing reflects in the preview side.
I publish the change and check the website and as expected nothing appears other than the custom "parking message"
I reopen customise then goto foo section again, the preview at this point has nothing other than the "parking message" I untick the checkbox, and the preview reflects that this time.
why the preview only reflects the change as expected when I untick the checkbox but not the other way around ?
thanks