This article maps parts of the world where heat will frequently exceed the human survival range. Look at how many whole countries are in that range. Their populations must either move or die. While some people will be unable to escape the fatal heat, many will flee for their lives. They will have nothing to lose by trying, no matter how unwelcome they are in the rest of the world. Their numbers are such that they will inevitably overrun any attempts to close borders. No matter how good your defenses, they always have a number limit. If you castle defenses are 10:1 they will fall as soon as 11:1 peasants storm the walls.