You are correct. If you have your front seats far enough back, the rear seat can clobber them as it swings forward due to sudden braking or bumping along rough roads.
I've attached a strap to the rear roll bar with a clip at the end. The clip attaches to one of the two latches that end up at the top of the seat when it is folded. The strap is one of those detachable nylon straps that are commonly found on soft briefcases.
That approach takes care of the seat rotating forward.
As for the seat rotating rearward, I generally don't drive with the seat folded and the cargo space unloaded. I just make sure that the load will brace the seat in its folded position and I'm good to go.
Hope this helps.