Is there an aphorism for doing a self-defeating act?
Solution 1:
“Don’t sell your mule to buy a plow” seems to fit your description pretty well?
Although, that’s actually not one I knew until just now. I had a vague memory of a similar British one — “selling your X to pay for its Y”, or something — and googling to try to work out what it was, I found the above version, which seems to be from the southern US. I still can’t work out what the original one I was thinking of was — does the form ring a bell with anyone?
Solution 2:
One may be "hoist on/by/with one's own petard" (literally, blown up by one's own bomb.) First seen in Hamlet, Act 3, Scene IV.
By the way - I received my second-ever speeding ticket on my way, not to traffic court but to traffic school, for my first. (I was young and foolish then - I'm old and foolish now.)