PKK-linked and -inspired militants had dug trenches, raised barricades and booby-trapped areas in neighborhoods where they have sought to claim autonomy, including in Sur, a historic district in the city of Diyarbakir, widely seen by Turkey’s Kurds as their regional capital.