How to access variables in the function where apply_filters() is called?

Short answer: you can’t.

You’re trying to access a variable outside of its scope. In your situation, $var_a is local to the get_var_b() function, so anything outside of that function cannot see it.

This is equivalent to writing this sequence in PHP:

function get_var_b() {
    // This variable is local to the function and invisible outside of it.
    $var_a = "a";  

    // Call a function that returns some value while passing in some default value.
    $var_b = create_var_b( 'default' ); 

    return $var_b;
}

function create_var_b( $default = null ) {
    // Inside this function, we only have access to $default because that's all that was passed
    // in. You can access any set global variables my making an explicit reference to 
    // "global $var", but only if the variable was globalized in its original scope.

    if ($default != null) {
        $var_b = "d";
    } else {
        $var_b = "c";
    }

    return $var_b;
}