To eliminate, or at least minimize, the oddity of a plane skimming a long distance through the canopy, a check on the plane's vertical velocity could be incorporated. At low sink rates, where the plane is almost maintaining height, we want the height threshold to be nearer to the top of the canopy, in order that we not see it continue unmolested for a great distance when clearly below the forest top. At ever faster sink rates, the height threshold could be lowered ever farther, all the way down to ground level for a sink rate higher than some selected threshold.
For example, this line, which finds the forest height above land where the plane is,
double d2 = Engine.cur.land.HQ_ForestHeightHere(flightmodel.Loc.x, flightmodel.Loc.y);
could have added immediately following (extremely simplified!)
if -sinkRate <= d2
d2 = d2 - sinkRate;
else if -sinkRate > d2
d2 = 0;
This would reduce the height threshold by 1m for every 1m of sink rate. If the sink rate is greater than the forest height, the forest height is set to zero (so that no negative heights can result for higher sink rates.)