This is much later than the bible, but interesting
There is a legend, first mentioned by Josephus in the first century AD, that Alexander the Great built a great wall or a gate to keep out the nomadic tribes of Gog and Magog and if those tribes ever get through the wall it will be doomsday. The Mongol invasions may have seemed like the fulfillment of that legend.
Some scholars have suggested that the legend was based on the Great Wall of China, built for a similar purpose.
It might be based on the Great Wall of Gorgan, the second longest defense fortification in the world, 191 kilometers or 121 miles long, between the southeastern Caspian sea and mountains to the east. Discovered in 1999, it is often called "Alexander's Wall", though it is believed to date to the Sassanian Dynasty and to have been built sometime about 400 to 600 AD.
The relatively narrow plain between the Caspian Sea and the mountains in the east is called the Caspian Gates. The much narrower plain between the Caspian Sea and the mountains in the west is also called the Caspian Gates.
There are only two practical ways to cross the Caucasus Mountains.
One is the Darial Gorge, which was fortified since ancient times including by Romans and by Persians and known as the Iberian Gates or the Caucasian Gates.
The other is at Derbent, where the Persians built a mud brick wall in the reign of Yazdigird II (438-457) and a better wall in the reign of Khosrau I (531-579) . This wall was up to 20 meters (66 feet tall) and 10 feet thick, and is called the Caspian Wall or the Wall of Alexander.