This phenomenon is due to Salafi schools of Sunni Islam not seeing other non-Salafi muslims as 'ummah', which was once a very fringe belief (Salafism was once pretty much unique to the Najd, a big sandy shithole in Arabia). The British supported the rise of the House of Saud, which originally came from that region, and the overthrow of the Hashemites (who had rebelled against the Ottomans alongside the British and were more moderate/mainline Sunni). This was done because the Hashemites, the traditional rulers of Mecca and Medina, had stridently opposed the Balfour Declaration and the creation of Israel precisely because they saw the Palestinians as ummah, whereas the Saudis had no such scruples.
The Saudis then proceeded to then use the oil money which they generated to spread their batshit insane version of Islam throughout the Middle East, and we helped them as we saw the religious extremism as a counterbalance to the Soviets, while the Soviets typically backed more secularist regimes. Basically any terrorist that mounts an attack in the West against Western civilians is a Salafist; Shias for example tend to focus laser-like on Israel and to direct all of their attacks in that directions. This is why most people have no understanding of Middle East politics - Israel gets along quite well with the Saudis and they support each other on the down-low in many endeavors because the Saudis are very amoral when it comes to expending non-Salafi Muslim lives. The spread of Salafi extremism and terrorism serves Israeli/American aims because:
1. They destabilize surrounding stable secular regimes which are opposed to Israel
2. They counterbalance Shia, Iran-backed proxies and anti-Israel Sunni militants
3. The terror attacks which they launch in the West provoke backlash against Muslims in general and sympathy with Israel as 'an enemy of my enemy', even though Israel is more friendly with the terrorists which attack Western countries and more antagonistic towards those groups which do not
4. These groups extend Saudi influence in the region at the expense of Iranian influence and secular Ba'athist parties, both of whom the Saudis loathe intensely. Moderate Sunni governments, outside of Erdogan's Turkey, are functionally extinct in the Middle East as major geopolitical players
Turkey's motives are more mundane - it's literally a question of border security for them, due to both refugee traffic and the ever-present menace of breakaway, cross-border Kurdish groups.