There's two reasons why your hat gets flipped off backwards. The obvious one is that you're hitting hard and the brim is catching water and flipping backwards.
The other is the hat is badly designed. The straps on the side have to form a wide based triangle a bit like the straps on a clubbies cap. The straps have to join the edge of the hat near your temples and almost to the back of your head. If the strap is close to your ear it will just flip off.
Some hats have soft brims that flex, but it's the configuration of the straps that make the biggest difference.
I added a strap to an old baseball cap. It never comes off. It's the similar to the clubbie ones below but without the bow. The chin strap just slides under my chin. The rear straps are set a little further back than in the pictures and slide freely on the chin strap. You slide them up, put the chin strap on, slide the other down and away you go. The ribbon can be put up inside the hat if you want to wear it out of the water.
I have a really old Dakine cap that is perfect. It has a long stiff brim, wide triangle ear covers and it never comes off. It refuses to wear out but the fabric is all bagged out. The new ones look ok but a bit flimsy. FCS do decent hats too. Patagonia are garbage.