Keynesian measures have an objective role to play in the function of the capitalist economy, primarily to create new markets for capital accumulation through redistribution of wealth. Such redistribution, far from being antithetical to capitalism, has been at its core from the beginning, e.g. enclosure. These measures facilitate capital flows and cut against the tendency of the rate of profit to decline. These interventions also tend to strengthen some groups within Capital (like high tech) at the expense of others.
In other words, the function of Keynesian programmes (which do not exist outside of or in opposition to Capital) is not to buy off the working-class to prevent revolution, but to expand the movement of Capital. The former, subjective, function of these programmes follows the latter, objective function.
Now the bolded is an important point and worth expanding on. The "counter-cyclical" nature of Keynesian economics illustrates its
stabilizing (regulatory) function. This was the whole point of the Bretton Woods system: to introduce a measure of rationality and predictability in a fundamentally irrational and unpredictable system.
Keynes's own central insight (or one of them, at least) was that the
rational decisions of individuals in a capitalist economy - especially one in which a larger portion of the population was engaged in the consumption of the goods and services provided by their employers (see: Fordism) - could lead to irrational
systemic outcomes, e.g. everyone from Wall Street bankers to low-wage laborers putting their savings under the mattress or whatever during a recession (only exacerbating the deflationary crisis of a recession).
Now I'm obviously grossly oversimplifying (and maybe getting some things wrong) about Keynes' economic theories, and leaving many things out, but for the purposes of this discussion the important point is that the inject of Keynesian policy measures and - perhaps more importantly - the building of centralized global financial institutions (the World Bank, the IMF, etc.), controlled ultimately from the "core" advanced capitalist economies in the post-WWII period, facilitated major state and (corporate) capitalist investment both short-term and long-term. And a good portion of this investment, in the context of the US being the unscathed capitalist superpower in the wake of the devastation of WWII, the urgent need to "contain" or even "roll back" Communism, and the growing power (and hence, bargaining power) of organized labor, ended up creating the "great middle class" in the advanced economies of the mid-20th century "Golden Age of Capitalism."
Of course,
all of this was only possible economically (and politically) in an era of massive pent-up demand (the aftermath of WWII), enormous industrial and state capacity, and the spectre of Soviet Communism acting as a counterweight to the natural tendencies of capitalism. By the end of the 1960s and certainly by the 1970s, a confluence of factors strained this so-called "detente" between capital and labor to the breaking point, and it did indeed break - and the unconstrained absolutism of capital came back with a vengeance.