The CIA thought they could force JFK to invade Cuba if their Bay of Pigs invasion turned out to be a dud. They were badly mistaken … about everything. The Cuban Revolution was at its most popular in those days and resistance would have been immense if the U.S. itself had actually invaded. Kennedy was wise to refuse to be drawn in.
Such an invasion would have been a disaster for the U.S., with ramifications everywhere in Latin America, in just then decolonializing Africa and in Asia. It would have been a huge gift to the Soviet Union in the Cold War (and in the Middle East) in those days when the USSR was also at it strongest.
It is also wrong that the Cuban Missile Crisis was just “a political stunt to make JFK look brave and tough” … though of course his administration was concerned about his domestic image as well the U.S. international one. It is wrong to think “everyone at the top of the ruling class” had (or ever has) one view of events, or even knows what dangers lurk in their own actions. It is actually scary when they all think alike on international policy — it makes it easier to miscalculate. Indeed, arrogant, unquestioned U.S. policy has caused the U.S. to waste its resources in many foreign adventures.
Today, the risk of accidental major war, even nuclear war, remains, and it can arise through adventurism and miscalculation, even accidentally.