Bingo. The collapsing to the side is exactly what I am talking about. Try strapping your ankle on the outside of your boot. The extra support should help you to get a feel for how your foot should sit in your stirrup.
The collapsing says to me that the ligaments in your ankles have been stretched out and are no longer supporting your ankle the way they are meant to. Adding the support using a brace or bandages should help. You may be able to train your foot to do it without the strapping eventually, but if you don't already have them I would invest in some long boots for constant riding support too.