From wikipedia:
Contrary to popular conception, there is no evidence that societies relied only on barter before using money for trade.[73] Instead, non-monetary societies operated primarily along the principles of gift economics, and in more complex economies, on debt.[74][75][76] When barter occurred, it was usually between strangers or would-be enemies.[77]
Came here to say exactly this.
If you want to dive even further into why the foundations of modern macroeconomics are bunk, then I can also recommend reading Debunking Economics by Steve Keen.