During times of economic recessions or depressions, while currency and markets are re-adjusting, could there be a back up system of local barter-style markets that could kick in and help reduce waste? For example, in the Great Depression dairy farmers let their milk go to waste because it was priced so low and there was enough supply that they couldn't make money off it. Could a system be put in place so that the milk -- while still retaining little monetary value -- could be used by local people rather than go to waste?
It is certainly true that disposing of milk or other agricultural commodities once produced is inefficient. The producers receive no income from commodities that are discarded, while there are consumers who would benefit from these commodities, so at least in principle finding a way to distribute them would be Pareto efficient--that is, it would make some people better off without making others worse off.
As a practical matter, of course, actually distributing surplus products is not free. The difference between what producers earn and what consumers pay reflects the costs of the distribution system, which includes costs of storage, transportation and the managerial work of figuring out where there are sources of supply and where there is need. A good illustration of this problem arose during the COVID pandemic. US potato farmers who customarily sold large lots of potatoes to commercial processors supplying chain restaurants suddenly found themselves with large supplies of potatoes. But the existing distribution system designed to ship and deliver batches of 50 pounds or more, was simply unable to shift to supply potatoes to consumers rather than middlemen.
These distribution issues are made worse, of course, by the industrial scale of much of the agricultural sector, which means that consumer markets are physical quite distant from where items are produced.
There is a larger economic question that you have raised, however, that we should also consider. Your premise is that lack of demand for a product is caused by a recession or other macroeconomic cycle (as opposed to the shock caused by the COVID pandemic). In such a case, economic problem is a lack of consumer demand caused by low consumer incomes. In such a case it is true that giving already produced goods to consumers would again enhance short-run efficiency (setting aside the practical concerns discussed above). But it is really a second-best solution to the underlying problem. Put differently, it would be better to find a way to restore consumer purchasing power, and let the normal channels of distribution do what they are designed to do. A number of existing policies do this. Food stamps for example provide those with low incomes with additional purchasing power. This program originated during the Great Depression as a way to support agricultural commodity prices without undermining consumer demand. Other policies like unemployment insurance similarly increase financial support as other sources of income decline. The large scale of federal assistance during the COVID pandemic, for example, meant that despite economic disruptions, consumers were able to maintain or increase their purchasing power.