Adding HTML class attributes to Entity Reference field links in View
So I finally figured out the problem.

I wasn't supposed to touch the $variables['items'][…]['attributes'] object, I was supposed to create a $variables['items'][…]['content']['#attributes'] array instead and put the class name(s) there.

Having done so, that now works.