Amphibious units don't ignore already destroyed buildings (pathfinding)

War Salamander and Azure Dragon have amphibious movement type. They don’t ignore already destroyed buildings, when they have to move to the other side.
Reproduction:



You can see in the pictures, despite of the wall has been destoyed, (you can destoy all of the walls), the Azure Dragons bypass the already destroyed wall and choose the longer path to attack the Barrack.

A similar bug has been reported earlier for naval units:

I created a simple video representation for this bug and updated the bug details:

I can assure you, it’s worth to watch.
There are two types of pathfinding: long range and short range. The long range pathfinding of War Salamander and Azure Dragon (amphibian units) doesn’t ignore the already destroyed buildings.
The video has 4 parts:
The long range pathfinding of War Salamander and Azure Dragon ignores the fact that the wall has already gone.
The short range pathfinding of these units doesn’t ignore it, it chooses the optimal path.
When I convert the wall into a Gate, the same thing happens.
When short range pathfinding leads War Salamander and Azure Dragon to go where a building stood before and they want to move away with long range pathfinding, they stuck.