Show only sidebar if widgets have content on the current page

Could the is_active_widget function dynamically check each widget
added to the sidebar if they have content and return true if any of
them have?

No, it couldn’t. You could check if any widgets have saved data on them, but whether a widget has saved data is not a good indication of whether or not it has anything to render. The only way this approach would work is if you personally inspected every single possible widget and made note of which values would result in the widget rendering anything.

The closest you could get is to capture the output of dynamic_sidebar() with output buffering and then check if it has any HTML in it before outputting anything:

<?php
ob_start();

dynamic_sidebar( 'sidebar' );

$sidebar = ob_get_clean();

if ( $sidebar ) :
    ?>

    <aside class="sidebar">
        <?php echo $sidebar; ?>
    </aside>

    <?php
endif;
?>

The problem with this is that some widgets could still output HTML, even if there’s no content visible to the user. In that case the sidebar would still be rendered. It might be possible to work around some cases by using strip_tags to remove any HTML before checking if the sidebar is empty:

if ( trim( strip_tags( $sidebar ) ) ) :

endif;