Insert div after h2 in content

You’re right, you can do that with a filter (the_content). I attached an example. You can put that into the functions.php of your theme.

function add_content_after_h2($content){
    if (is_single()) {
        $div = '<div>small bit of content</div>';
        $content = preg_replace('/(<\/h2>)/i', '\1'.$div, $content);
    }

    return $content;
}

add_filter('the_content', 'add_content_after_h2');

Here you find the WordPress Codex with a detailed description of that filter:
https://codex.wordpress.org/Plugin_API/Filter_Reference/the_content