Why do people try to make themselves feel better by treating others poorly?
What I'm looking for is an explanation of Anne's behaviour in terms of
psychoanalytic theory.


In Freudian psychology this is called Displacement:


  ... an unconscious defense mechanism whereby the mind substitutes
  either a new aim or a new object for goals felt in their original form
  to be dangerous or unacceptable.


For example:


  ... a college student may snap at his or her roommate when upset about
  an exam grade.


Note that psychoanalytic theory is outdated, and for the most part considered pseudoscience.  The concept of defence mechanisms in general has largely been superseded by cognitive dissonance theory.

Not related, but you may also be interested in Schadenfreude.