Chazar,
That sounds good in theory but won't work in practice. Plus it still won't compute the optimal path.
For example consider this
S = stack, X = destination
H = hills
M = mountains
XHH
MMH
SHH
In this case the flyer path will go directly over the mountain. But the land path must move around. The optimal way to move is to separate the units manually and re-join at X.
Also the flyer path is going to consider moving over water/mountains which land units can't (or over land which water units can't). So you can't be guaranteed to use the flyers path which is going to require coding to handle that the flyer path may be invalid and then throwing out that path and then potentially attempting another flyer path etc.
I suspect it will get really messy trying to do all that plus handle multiple paths and figure out which leaves the most moves for everyone (especially on REALLY long paths that take multiple turns to complete where it's going to be VERY rare that the 2 paths are identical). Then debug it all and make sure something hasn't broken someplace.
KGB