There's the JFK quote: "It's not a very nice solution, but a wall is a hell of a lot better than a war," but I don't understand how the wall affected the potential for a war. Was it as simple as Khrushchev was concerned about West Germany so the Wall kept out West Germany (through Berlin) and therefore avoided a war with West Berlin and by extension the US? A wall does very little to stop bombers so in the era of nuclear weapons how does a wall prevent war?
It was more the opposite of your suggestion though you are on the right track with the issues arising from intermingling. One very real problem being solved was that with no real barrier in place East Germany (and East Berlin in particular) was bleeding residents who knew they could essentially flee into West Berlin and then seek a route into West Germany. This was pulling human capital out of the city which was making an already stagnating economy all the more precarious.
On top of/adding to this, the Cold War was very much a clash of social/economic/political ideologies with the basic assertion from the Soviet side being that Capitalism would never produce a stable and equitable society and that Communism was the next stage in economic systems to replace Capitalism and achieve these things. So, with literally two major blocks of the world following their chosen ideologies we can look at this as a major experiment in motion and by the time of the Kennedy administration it was becoming obvious that the Capitalists were pulling standards of living up in their areas of influence as well as leading to more individual freedom (this is a democratic vs authoritarian factor rather than the merits of capitalism/communism per se). Optics were not great if you were living on the Soviet side and seeing contradictory realities in the west vs what your government was claiming.
So, coming back to Berlin. You literally had a single city where citizens living under one of these ideologies or the other could essentially walk to the other side of town and see for themselves what the fuss was about over there. For the Soviets who understood the widening gap in standards of living, and who very much relied on state controlled information to justify their ideology (which was being imposed on the entire nation) this was a threatening position for leadership. Both from the sense that there was concern of internal discontent that could lead to some level of revolt (as was seen in Hungary in the 50s) or the simple brain drain effect where the majority of defectors were the better educated elites who were most critical in attempting to build a robust local economy - basically causing a fear of losing further ground economically to the west.
The wall basically put a stop to that. West Berliners can go about their business in a thriving city, and East Berliners can see/hear only their propaganda and have a hard border to repel defectors.