Less luck than topography.
Thanks to that horrifying wall of mountains that is the Himalayas, there's basically only a handful of routes between Asia and Europe. All of them except for the one through India require punching through several 'stans followed by invading Russia. On top of that, because of how India happens to jut out into the Indian Ocean, their territorial waters, and more importantly the area their military can hit from ground bases, commands most of the viable sea routes between Asia and Europe (also the Middle East if you happen to want, say, oil). Basically, if India says no,
absolutely nothing gets to travel between the Middle East and Asia, and precious little from Europe to Asia unless they want to take the horribly long route.
India having those enemies was inevitable because India is in their way. Poland has been invaded by everybody in Europe for roughly the same reason, mountain ranges funnel any travel between Europe and Eurasia through Poland. Afghanistan has a similar history because they're a valley running through those mountains and thus, presuming you can get the Afghanis to play ball*, you have a viable route through those mountains, which is what China's trying to do now.
A huge number of weird wars, strange marches, and rivalries make much more sense if you quit looking at the borders of political maps and instead look at the topography and how mountain ranges shape travel routes.
*Nobody has ever gotten the Afghanis to play ball.