How to fix the disappearance of the “\” character when updating a post in the database

I’d use your friendly neighbourhood WP functions – look – here’s one!

wp_insert_post()

In your case it would be something like:

...
$post_content = $this->add_image_dimensions( $post->post_content );

$update_post = wp_insert_post(
    array(
        'ID'           => $post->ID,
        'post_content' => $post_content,
    )
);

// Don't forget error handling
if ( is_wp_error( $update_post ) ) {
    $error_code    = array_key_first( $update_post->errors );
    $error_message = $update_post->errors[ $error_code ][0];
    wp_die( "Post Update Error: Post ID: $post->ID  - $error_message" );
}
...

That will correctly add slashes before adding to the DB so they can be stripped correctly on read.

If you do insist on running direct queries, prepare your damned write statements!