The problem is that we can't ask the pathfinder to go in range of a rounded rectangle.
So we approximate the target as a circle. But we pick the circumscribing circle. In cases where we don't approach the corner, the distance "circumscribing-circle" to entity will be higher than the real "square-obstruction" to entity distance, and we won't get in range.
To fix this, we need to get in range of the inscribed circle.