It should already work like that, if it doesnt it is a bug
If you have your stack selected and see the small flier-symbol (to the right of the "selectrow"), then you should have a stack of only flying units. This stack should ignore all terrain (except avoiding enemy/neutral cities).
However, also flyers move cheaper on roads, so the flyerstack will prefer moving by roads whenever possible.
So probably this is what happened with your path?