Why Delhi? Why Agra?

Ganges is called the bloodline of the North India, yet the 2 capitals of India has been on the banks of Yamuna. Historically capitals were located based on 2 strategic consideration:
1. Securing the state’s economy (agriculture, trade-routes land/sea, mining etc.)
2. Gain tactical advantage by making it easier to dispatch soldiers/couriers, receive reinforcements, making it difficult for invaders to lay a siege or run a campaign
The first cities were in the middle of some of the most fertile land (which paid for military in return of the protection). Cities like London, Paris, Alexandria (Egypt) and Calcutta were ports designed to control the sea route.
Rome was in the middle of peninsula which made it accessible by sea from 3 directions (and call reinforcements). While it’s cold weather and rocky terrain would demoralize any army marching. Carthaginian General Hannibal Barca lost almost half of its troops in the march to Rome. Atilla the Hun did march up to the gates of Rome, but did not lay a siege. However Rome had to heavily invest in the road infrastructure (All roads lead to Rome) to ensure that in spite of being inaccessible the city serves its purpose of securing the economy and ensures mobility of troops.
Only when the empire became weak ( 410 AD, Alaric the I, (Visigoths) and 43 years later, Geiseric King (Vandals) did invade Rome) the capital was shifted to the marshy lagoons of Venice. Venice then continued to rule the Mediterranean till 15th century. The port provided connectivity and ability to control the economy, while the marshes made it impossible to lay a siege. Charlemagne’s army (including the son) was ravaged by the 6 month long siege that they laid on Venice. (not to mention the expense of a combined naval blockage and siege).
Now back to the question, why Delhi and Agra were centers of India? The north India is often called as Ganges Basin highlighting the importance of Ganga in the economy. Like the Nile, the water from this perennial river and the silt from its banks made this as the most fertile lands. No wonder almost all major Indian cities were on its banks. Lahore, with its ability to control the Indus River would have been a better choice. But the distance between Pakistan’s Punjab and Delhi is considerable. Delhi can also not be called center of the 2 river systems as relatively less economic activity happened in Madhya Pradesh. Hence it being the center of Mughal empire is questionable.
Yamuna in comparison is a much smaller river. Also the terrain is quite flat negating the possibility of a tactical advantage. Rivers are natural roads allowing navigation, but again Yamuna was never used as inland waterways.
The terrain provided no advantage. Delhi was ransacked and rebuild 7 times (maybe more). Agra/Fatehpur Sikri was abandoned. Hence the question why is Yamuna river the political capital of India?