It's not a bug. Number of jumps isn't as important to travel time as total distance; if you were to look at exactly how many seconds it'd take to travel the two routes, you'd see that the route it did take was clearly superior to the one you thought.
In the first case, the key is where you hit the grav well on that asteroid belt at the bottom; you enter it, and then turn and leave from almost the same spot, so very little in-well travel needed. If it'd taken the upper route, on the other hand, a fleet would have to fly through the entire well and around the wormhole, taking substantially longer. The fact that the phase lanes are slightly longer is irrelevant compared to the amount of time spent in-system.
Likewise, on the second example, the two paths are:
1> Go through an ice planet well (moderate time), turn on the corner of a well (short time), go through an asteroid well (fairly short time), hit target.
2> Go most of the way across the star's well (LONG time), go through a gas giant well (moderate to long), go through a wormhole (fairly short), hit target
Again, the path it actually took was the superior one, even if it looks at first glance to be the long way. So no, not a bug.