One of the main purposes of border Walls, which are older than the Middle Ages by far, is to provide not only a barrier to enemies crossing the border, but a transportation avenue for your border guards responding to an unauthorized crossing (i.e. an invasion). Which implies another factor: Border Walls require garrisons of Border Guards.
Michelle had no problem spending taxpayer money to take her girls to The Great Wall of China.
.
Agreed, a border wall with out guards is not an impediment to unauthorized access.
Than is why we had bunkers and towers surrounding our basecamp perimeters in Viet Nam.