Deliberately hurt, annoy, or offend (someone):
"he put the house up for sale to spite his family"
For an idiom related to the OP's question, perhaps:
cut off your nose to spite your face
to do something because you are angry, even if it will cause trouble for you
Or, a slightly different context and without necessarily being directed at someone else - usually unintentional, but potentially directed at someone else so they'll feel the effects:
throw the baby out with the bathwater
to get rid of the good parts as well as the bad parts of something when you are trying to improve it
In real life, someone's lack of caution or recklessness in "throwing out the baby with the bathwater" could be so foolish and harmful that others might be convinced that it was an action taken out of malice. And indeed, it may have been a malicious act.
And finally, the behaviors in the OP's examples, in my view, are:
Of or denoting a type of behavior or personality characterized by indirect resistance to the demands of others and an avoidance of direct confrontation, as in procrastinating, pouting, or misplacing important materials.
At least, the messy kitchen example is passive-aggressive. The high-beams example qualifies as:
Violent anger caused by the stress and frustration involved in driving a motor vehicle in difficult conditions
And so I actually think the danger posed by acting in this way elevates the action beyond the OP's characterization, if the OP is implying at all that the action should basically be harmless.