Hehe that sounds very familiar! I find that it helps to really concentrate on keeping the weight down into your heels, so you let your legs hang more. I'm sure you know this, but it's when you press on the stirrups to help you rise that your (and my) legs tend to swing.
Doing rising trot without stirrups will help you to keep your legs down and long, and to learn to rise without pressing down on your stirrups.
And don't forget you don't need to rise more than half an inch out of the saddle anyway, so if you make your rises smaller and concentrate on pushing your pelvis towards the front of the saddle it should help to stabilise your legs.
And I think that you kind of gave yourself advice when you said that it improves when she's going more forwards in the trot. It's very easy to overstate your rise to make up for the lack of impulsion from the pony.
Sorry that was a bit of a mish-mash of advice and not explained very clearly, I'm exhausted but recognised one of my main problems in what you said.