Add filter unless it is being called under specific function

WordPress only holds the hooks information in global $wp_filter so you can check if a hook is registered with some specified function or not. you can also use function has_filter.

But I guess you can not check that, it has been called or not on some specific execution point.

But you can do this with PHP using global variable.

Check this code

add_filter( 'get_the_excerpt', 'my_trim_excerpt' );
function my_trim_excerpt($text) {
    global $filter_applied;
    $filter_applied = true;

    $text = wp_trim_excerpt($text);

    return $text;
}

add_filter( 'the_content', 'my_content_filter' );
function my_content_filter( $content ) {
    global $filter_applied;

    if (isset($filter_applied) && $filter_applied === true) {
        //Your code when wp_trim_excerpt is already called.
    }

    //my code that modifies $content

    return $content;
}

Here I am using a global variable $filter_applied and modifying value on wp_trim_excerpt then checking it on my_content_filter