If you attack the top then it will rotate the bottom stick to attack you. What is that?
Not really sure if I have ever come across something like that.
But I think this is what you are looking for: the "spar bar". To get the bar to "attack" you, you actually have to hit it so it spins and come back for your head (you can then hit it back, block it, or go under it).
There is a wall-mount version too (but there is no "head" in this one).
Title boxing makes some of these equipment: TITLE Rapid-Reflex Boxing Bar Tri-Bag They have a few different things in their website like the King Cobra Reflex Bag, which can be used for training defensive moves too.
But they are all a bit expensive. So may be look at craigslist or something like that first if you don't want to spend that much.
*All images and gifs are from google. And I am not a sales person for any of these brands.