Im not sure about pakistan but turkey will not directly attack Iran. They have learned their historical lesson and havent looked at Iran the wrong way in over 200 years.
During that time Iran was significantly weaker, and turkey was on paper much stronger. They had many chances, as recently as 1980s where they could have potentially made a move
Iran and turkey have wisely decided its not in either countries interest to be hostile
I think the lesson of nader shah has permenantly scarred turkey. Safavids were dead, afghans had taken ovef half of Iran, and turkey was slicing Iran up with Russia.
Then Nader Shah beat the shit out of them So badly and repeatedly that it scared the russians into handing back iranian territory without a fight.
Turkey has never had an aggresive attitude towards Iran since