I think both of us are not sure about this.
Iran is a country with itself civilization、large population、long and golorious history. Iran have its ambition as a leader in middle east or lslamic world. the same with turkey and KSA.
These three country struggle to broaden their influence in ME.KSA as a religious leader have build GCC. Turkey, after more than 50 years failling to join EU, now begin to pivot back to ME, and build their military base in qatar. Iran, step by step, broaden its influence from iraq\yemen to syria around. It is reasonable for iran to build military base in syria, they have cast so many blood in this area.
pakistan play a important role in islamic world. Both of these three need keep a good relationship if they want to achieve their goal. Out of islamic world, these three country need to keep a good relationship with P3 if they want achive their goal eventually