Money, as a store of value, can affect macroeconomic allocations.
The classical reference is Samuelson 1958 (google for the paper if you don't have access to it).
In your example, all the traders meet at the marketplace at once and exchange goods. In this case, you are right to say that although money makes trading more convenient, it does not affect the end allocations (as long as people have the time and patience necessary).
Samuelson consider a different setup, where all agents cannot meet in the same marketplace at once, because some of them are not born yet. A simplified version of his model looks as follows:
- Time is infinite and discrete, $t=0,1,2,\ldots$.
- In each period $t$, a generation $t$ consisting of $1$ person is born. A generation lives in two periods (so generation $t$ lives in periods $t$ and $t+1$. People are born without any assets.
- In period $0$, there already exists a generation $-1$ of old people. They have nothing.
- People work when they are young, and produce $1$ apple. When they are old, they cannot produce anything. Apples rot if they are not eaten the same day they are produced (they are not storable).
- People get utility $u(c^y)+u(c^o)$ if they consume $c^y$ apples when they are young and $c^o$ apples when they are old. $u$ is concave, for concreteness, let $u(c) = \sqrt{x}$.
- In each period, people can trade with each other.
In this model, the following will happen: In time $0$, generation $0$ will produce $1$ apple. Since generation $-1$ has nothing to offer them, no trade will occur and generation $0$ will consume the apple themselves. In time $1$, generation $1$ will produce $1$ apple. Since generation $0$ has nothing to offer generation $1$, generation $1$ will consume the apple themselves. And so on. Every generation will consume $1$ apple when young and $0$ apples when old (except generation $-1$ who will consume $0$ apples when old but will not exist when young). The utility of each generation will be $u(1)+u(0)=1$.
Now consider what happens if the initial old have a piece of paper that we call money. Let us say that the piece of paper is considered to be worth $0.5$ apples. What will people do?
The initial old will obviously swap their piece of paper for $0.5$ apples (they are about to die and have no reason to die with a piece of paper in their hands instead of apples in their bellies). Will the young accept the trade? They have one apple today, but no income tomorrow. Since their utility is concave, they would prefer to consume a little bit today and a little bit tomorrow rather than all at once today. Therefore, they accept the trade, and give up $0.5$ apples today for the piece of paper, with the expectations of being able to swap the paper tomorrow for apples tomorrow. In period $1$, the old will happily swap their piece of paper for $0.5$ apples, and the young will accept the trade for the exact same reason as the young of period $0$ accepted the trade. Every generation will consume $0.5$ apples when young and $0.5$ apples when old (except generation $-1$ who will consume $0.5$ apples when old, and not exist young). The utility of each generation is $\sqrt{0.5}+\sqrt{0.5} = \sqrt{2}>1$.
The introduction of "the social contrivance of money" affected macroeconomic outcomes, and in fact made everyone better of. Note that we can equally well call the worthless paper in this model "government bond" or a pay-as-you-go retirement scheme promise.
This little exposition is informal, and I definitely cut a bunch of corners. Read the paper, or any good textbook exposition of overlapping generation models (OLG).