I see this phenomenon a lot in the context of politics and when people discuss social issues, but I'd like to offer a non-political example:
Person A: This mathematics course has been amazing, I have learned a lot of new things!
Person B: It's good to have the basics down for when you decide to take part in an actually challenging course :)
A and B work at the same company.
Person A: I got a raise!
Person B: Huh, they're handing raises? Maybe I should go ask for one as well!
Person A: I didn't have to ask for it, since I've been working hard :)
In example 1, I'm looking for a word for what Person B is doing and in example 2 I'm looking for a word for what Person A is doing. This is something that annoys me to no end - it can be so malicious while sounding so sincere and friendly.
I guess it could be interpreted as passive-aggressive as well, but I am pretty sure I have heard a different, more specific word for this.