code block does not show in excerpt

Try getting it in raw form from the DB:

global $wpdb;
$post_excerpt = $wpdb->get_var(
        $wpdb->prepare(
            "SELECT post_excerpt FROM $wpdb->posts
             WHERE ID = %d
            ",
            $post->ID
        )
    );