The goal is to replace the word 'attachment' in attachment URLs to read another word, so vising an attachment would be like:

site.com/category/article-name/NEW-WORD/attachment-name/

Is this even possible in WordPress? I'm not sure if it would be better to completely replace it (so there is no 'attachment' URL) or just add a URL so that both /attachment/attachment-name and NEW-WORD/attachment-name would work (in order to avoid possible problems if WordPress updates something related to attachments).

WordPress helper Milardovich suggested this as one possible way to do it, but it didn't work for me (the /IMAGE/attachment-name URL just brings a 404, but nicely the attachment/attachment-name still works). 

    function wpd_attachment_link( $link, $post_id ){
        $post = get_post( $post_id );
        return home_url( '/images/' . $post->post_title );
    }
    add_filter( 'attachment_link', 'wpd_attachment_link', 20, 2 );

Adding to this Milo's code (below):

    function wpd_rename_attachment_rewrites( $rules ){
        foreach( $rules as $key => $value ){
            $new_key = str_replace( 'attachment', 'new-word', $key );
            unset( $rules[ $key ] );
            $rules[ $new_key ] = $value;
        }
        return $rules;
    }
    add_filter( 'rewrite_rules_array', 'wpd_rename_attachment_rewrites' );

Now the code(s) has some effect but doesn't completely work because its not directing to the correct URL (it's removed the category/article-name/ from the attachment URL when you click on the link for an attachment page, so you get this:

Wiewing attachment page for an image goes to:

    site.com/IMAGE/image-name

… which is nothing there because its a different URL from the correct new attachment permalink, so its an Error404 on the front end when you visit that URL.

However, you can get to the correct URL by typing in:

    site.com/category/article-name/IMAGE/image-name

… and brings up the correct attachment page.

So is there a way your code can be adjusted a bit so that when you click on the attachment for an image, it goes not to `site.com/IMAGE/image-name` but instead goes to `site.com/category/article-name/IMAGE/image-name` (ie it adds `category/article-name` to the URL direction)?