Prevent WordPress from putting around specific element

Seems you have something plugin, that causes the problem, because WP doesnt put hidden anchors in the content. have you double checked the post-editor textarea (html/visual) to determine when that ..anchor.. appears?

however, i dont recommend filtering, instead, save the CORRECT CONTENT in the back-end, instead of filtering the incorrect content on front-end.

use something like this:

add_action('save_post', 'my_filter_func',1);
function my_filter_func($post_id){
    if ( ! wp_is_post_revision( $post_id ) ){
       $_POST['post_content'] = str_replace('<a class="anchor"> OR WHATEVER SHOULD BE THERE,  '',  $_POST['post_content']);
    }
}