It's not just FPTP. FPTP creates the two party system, but something else creates partisanship (as evidenced by numerous other countries that have FPTP and two parties, but they're nowhere near as diverged).

My theory is that what creates partisanship in US is primaries. It might sound counter-intuitive, but hear me out.

In the system without primaries, the candidates that run in general elections are decided through inner party politics, in which only party functionaries participate. Said functionaries generally wield influence proportionate to the amount of time they spent within that system, and they constantly fight each other for power and influence. Since they don't have to explain themselves to the voters in the process, ideological concerns are secondary to influence. Furthermore, because of how byzantine such systems can get, you get a lot of compromise and power sharing happening on all levels - and any functionary has to go through multiple levels to get to the point where they can contest for general election nominations, so they are well-conditioned in power sharing / compromise arrangements, and consider them natural.

This system naturally rewards more moderate politicians that are capable of such compromises, and sideline more extreme (ideologically pure) ones that might not compromise for the sake of ideology. So by the time the voters have their say, they usually pick between two moderates. Overall, the parties remain relatively close, with a lot of overlap on their respective moderate/centrist flanks.

Now consider what happens when you add primaries open to the voters (even if it's just registered party voters). On one hand, voters don't participate in the routine, day-to-day party politicking - they show up to vote once per cycle, and that's that. On the other hand, because primaries are perceived as less important than the general, the turnout bar is higher, and only the more motivated voters show up at all. These voters tend to be more extreme, because ideology is a strong motivator to vote, and comparatively fewer centrists/moderates feel strongly about their centrism. Thus, you get electorate that 1) is more towards the extreme end for the party, and 2) is not inclined to compromise or power share.

Now your candidates need to pander to that electorate in order to win the primaries and advance to the general. Initially, it wouldn't make that much of a difference, because embracing the extreme views becomes a detractor in the general - so long as parties remain close, moderates from either party can swing easily, and so it's important to both attract as many moderate voters as possible from the other party, and to not let your own moderate voters defect. However, there needs to be some pandering in the primaries, and so the rhetoric there becomes a bit more extreme - and the parties start slowly drifting apart.

And this becomes a positive feedback loop. As more extreme positions get gradually normalized, party platforms drift apart, and those stuck in the middle are forced to sort themselves out. At the same time, because of increasing distance, each party sees the other as more hostile, which drives more heated rhetoric that further promotes more extreme sentiments. A lot of it becomes less about policy rationalizations, and more about emotional appeal (just look at most of the arguments surrounding abortion today, and compare to the same 40 years ago).

This, in turn, decreases the utility of pandering to moderates in the general. Once parties are sufficiently far apart, most moderates will start voting for extremists in their own party over moderates in another party (even if they hold their nose). So the risk of pushing away your own moderates by adopting extreme views in the primary is reduced substantially, and at the same time the moderates from the other party are no longer a viable target demographic. At this point, primaries become a race to embrace more and more extreme politics, because whoever does it best moves on to the general. This accelerates the loop further.

The other aspect that I think plays into it is the desire of people to "belong". When parties are close, ideology matters less, and it's possible to self-identify with one of the parties while not adopting large parts of its platform - and, for that matter, the platforms themselves are much more vague and have fewer uncompromising points in them. But when the parties spin apart ideologically, and ideology itself becomes more prominent in party identification, there's a trend for people who initially joined the party because one of its positions to adopt its other positions as well, as a single ideological packet. So, for example, 40 years ago, someone might be a Democrat because it was a pro-labor and pro-union party (and they didn't really care about the rest); and another, because it was a pro-civil rights party (and they didn't really care about the rest); and so on.

But today, most members subscribe to most or all of these positions, with deviation on even one of them often seen as ideological betrayal, triggering a rejection response (all those labels like "RINO" or "Fox News liberal"). The resulting ideological packages aren't even particularly coherent - consider a triad of taxation, gun control and abortion for an example of seemingly unrelated things that have an extreme correlation today - and largely represent the amalgamation of ideas that parties acquired in their historical evolution. But because each package has so many "wedge" issues, their broad acceptance pretty much guarantees polarization in the electorate, because at least one, and often many, are strongly emotional. So for a Republican, the notion of compromising with a "baby murderer", for example, becomes unthinkable. And for a Democrat, the notion of compromising with someone who "denies the right of LGBT to exist" is unthinkable. And they both carry those concepts to their respective primaries, and elect such candidates that promise to be as hardline as possible in the ideological struggle against those unthinkables.

The worst part of all this is that it's not a problem that can be easily solved unilaterally. If a faction in one of the parties realizes that this all is not in our long-term advantage, and decides to dial its rhetoric down, it'll get hammered in the primaries. And if it manages to advance to the general, it will often get punished by partisans from its own side (either not showing up at all, or showing up to vote for some independent or third party "alternative candidates"), and lose to the other party that remained true to its partisans.

Same thing goes for cooperation and compromising after election. Because elected representatives have to contend with primaries, they cannot be seen as too weak, otherwise the partisans in their own party will throw them out as not sufficiently ideologically pure (again, "RINO" etc) and replace with hardliners, like Tea Party did in 2010. So the advantages from cooperation across party lines are diminished to the point where it basically stops altogether, and anything and everything becomes a straight party line vote. Partisanship defines politics in all respects: everything that is legal is fair game to stop, or at least frustrate, the other party, because you know they will do the same to you when it's their turn. To maximize the gains from a political victory (in terms of ability to push your ideological agenda) in such a system, you need to mercilessly steamroll over the opposition when you're the majority party, and obstruct as much as you can when you're the minority.

I think we're already in that endgame. Republicans have arrived here first, with the Tea Party. Democrats are now learning that this approach works best, the rules being what they are, and are adopting similar tactics. The inevitable outcome is complete deadlock of the government, with occasional bursts of frenzied activity when one party happens to take over both legislative chambers and the presidency (as seen currently), to cram as much as possible in while they can.

The only legitimate way out, so far as I can see, is to rewrite the rules. But it needs to apply to both parties at once to be effective, it can't be a unilateral attempt. So most likely we're talking about a revision of the electoral system here. A true proportional representation, or at least some sort of transferable vote, would make centrism more viable, and push the extremes back into the fringe. But such a revision is made extremely hard by the existing rules (it would probably take a constitutional amendment), and there will be considerable resistance from the partisans who would stand to lose political power in it.

Which means that the current dysfunction will continue until a truly major crisis breaks the system to the point where it can be rebooted.