There were bitter partisan disputes before the Era of Good Feelings. There were (and still are) bitter partisan disputes after the Era of Good Feelings. Yet for 8 years everyone just kind of got along. Only one political party (Democratic-Republicans) was in existence. Not only did Monroe win every single state in the 1820 election, he ran unopposed. What led to this feeling of national unity? Why have we never seen anything like it since (not even after WWII or something)? The War of 1812 was a very destructive war. Washington DC was burned and the US didn't even "win" in the end. "The status quo is being maintained after years of war" seems like it would be a difficult thing to rally the nation behind. So what was it? It came to an end after Monroe's presidency. Was Monroe just that skilled of a politician?
The short answer is that no one was celebrating the specificities of the Treaty of Ghent, they were celebrating the United States defeating two large-scale British attempts to capture American territory, at New Orleans and at Plattsburgh. Both of these events were treated in the popular press as astonishing victories demonstrative of the American spirit and warfighting ability. These weren't enough on their own to "unify" Americans, though; it was also coupled with the absolute destruction of the Federalist party as a meaningful pole of political opposition.
Brief background: the drafting of the constitution and arguments over its ratification split the American political elite into two camps; the Federalists, or those who encouraged and supported the ratification of the constitution and a much stronger executive than was possible in the Articles of Confederation; and the Anti-Federalists, who opposed the constitution and wanted to limit the power of a hypothetical executive, leaving all of that power to individual states (obviously, this is a very simplistic rundown of a lot of complicated ideas, but its an alright start). After the constitution was ratified, these parties did some ideological shifting, and the United States was left (eventually) with two slightly different parties: the Federalists and the Democratic-Republicans.
To again being somewhat reductive, the Federalists maintained their belief in a strong executive, and the new Democratic-Republicans still wanted the bulk of power in the United States to reside with the states. But neither party was entirely ideologically unified; there were at least two distinct ideological branches of the Federalists, and there were other divisions within the Democratic-Republicans. Geographically, the majority of Federalists were northerners, and the majority of the Democratic-Republicans were southerners. You were more likely to find abolitionists among Federalists than Democratic-Republicans (the obvious inverse, that more D-R's were slave owners, is also true).
These poles were a major aspect of the majority of policy debates in the "Early Republic;" that is, the period between the ratification of the constitution and, hey what to we have here, the "Era of Good Feelings."
Where this gets us to the War of 1812 is that after Jefferson's "political revolution" in 1800, the Democratic-Republicans (chiefly the Virginia D-R's, like Jefferson, Madison, Monroe, etc) were the primary architects of American policy. There was a fluctuating, somewhat irascible, somewhat patchy and disunified opposition in the form of several constantly shifting ideological poles of the Federalist party. Early efforts centered mostly around Alexander Hamilton's technocratic-financial policy advocacy (and let's not forget his military trumpeting), but after his death in 1804, everyone (of the time and even historians) were quick to declare the death of the Federalist party.
But then, around 1807, the Chesapeake Affair brought Federalist policy opposition back to something resembling its earlier strength: Jefferson's blunders in response to the crisis were viewed as partisan, needlessly punitive, and incompetent, and the resistance to the Democratic-Republican drumbeats became a newer focus of the opposition party.
So then, the war broke out, and as it was a war declared on Great Britain by the United States by a very slim margin, the opposition continued opposing it, both at a policy level (voting against war measures, funding, and other necessary elements of fighting a war) and at a popular level (rallies, acts of political opposition, militia resistance and others) continued throughout the duration of the war. By 1814, opposition Federalists met at Hartford to discuss, among (many) other things, northern secession and a separate peace with Great Britain. It never happened, but the possibility was enough to spook Madison and his supporters, and in the coming months, the major victories at Plattsburgh and New Orleans were enough to turn what had been rational (if political partisan) political saber-rattling into something closer to treason.
The "victory" (or perception thereof) of 1812 more or less vindicated the Democratic-Republican political apparatus and trashed its Federalist counterpart. Very few politicians were able to hold on to the label "Federalist" and stay in office. So what we got in the Era of good Feelings wasn't so much unity as it was a total suppression of the only meaningful opposition, for a time. I wrote a bit more about it here..
Sources given in linked comments, but mostly:
Jon Latimer, 1812, War with America
Donald Hickey, 1812, A Forgotten Conflict
Hugh Howard, Mr. and Mrs. Madison's War
Nicole Eustace, 1812, War and the Passions of Patriotism