Russian President Vladimir Putin has warned ex-Soviet allies that foreign backed militancy fuelling the war in Syria could reach their countries.