Automatically deactivate link for attachments

With markup embedded into the content there is no less tricky way than regex to do it, save perhaps a markup parser like SimpleHTMLDom

function remove_image_link_102512($content) {
  $pattern = '|<a.*?href="https://wordpress.stackexchange.com/questions/102512/(.*)".*>?(<img.*?/?>)(?:</a>)?|';
  $content = preg_replace($pattern,'$2',$content);
  return $content;
}
add_filter('the_content','remove_image_link_102512');

As with all regex + markup solutions, I’d test that thoroughly. Of course, as no saved data is updated it won’t catastrophically or permanently break anything if it fails.