My mare does this when you ask her to go into canter, what has helped me a lot is riding with a dressage/long whip and every time they do it just tap them with it and squeeze on they should eventually get out of the habit ☺️
Maybe this is bad advice considering three completely opposite posts but my horse offered to buck me (I know, different than cow kick) one time. I threw my outside leg on him and bent him around it while keeping his feet moving. He never tried it again. It might be worth a shot :)
A tight core, and good grip with your legs. Either give a good kick during the buck or a good smack on the shoulder afterwards. Never discipline with your reigns.
Lean back and push them forward. Also don't ever be afraid to grab the main
Just keep you your core tight, use leg and just kick them through the bucks :)