Is that actually legal? I'm not quite sure it qualifies as a headbutt...
No it should be illegal in any jurisdiction that has a commission that exactly duplicates the unified rules, i.e. Any use of the head as a striking instrument whether head to head, head to body or otherwise is illegal.
But not all commissions have the fine print and technical definitions that the ABC does.
But even if they do, some fighters don't know the rules by heart. I know it seems strange that not all fighters actually know the fine print of all the rules, but that's how it is. Rampage (and other fighters) have said they thought strikes to the knee were illegal, but that's only true in amateur rules. During the Silva-Lutter fight, Randy was commenting that Silva's elbows may have been illegal, showing he didn't know what 12-6 elbows were. Multiple fighters have said they thought you needed three taps to submit when that's not true.
There's a video of BJM doing his prefight rules meeting with fighters where he asks them if they know all the unified rules. They all indicate that they do and he says they're a bunch of liars.
(It has some swearing, just in case anyone's watching at a strict workplace or has delicate sensibilities)
I wouldn't call someone who headbutted with his chin to the body dirty when it's very possible someone could reasonably think a headbutt is striking with the thick parts of the skull to your opponent's head. I don't recall seeing Jones ever headbutt with his chin again after I saw a ref tell him to stop.
I mean, everyone has their own definition of dirty, but mine is more along the lines of intentionally doing something you know is cheating to hurt someone. Like Frank Shamrock kneeing Renzo in the head on the ground.