I don't think it's going through Afghanistan. It's probably just re-using Soviet railroads. But it is going through Turkmenistan, which is one of the craziest insane and most bizarre and unpredictable places one can think of, and Uzbekistan, which used to happily host US troops in Khanabad. Just a matter of some cash and some threats of sanctions with either one of those two.