If a rock in a stream happens to serve as a convenient steppingstone, we regard its usefulness as an accidental bonus, not a true purpose. Simply to overtop rival trees. They would get exactly the same amount of sunlight, with far less expenditure on thick trunks and massive supporting buttresses. But if they were all short, natural selection couldn't help favoring a variant individual that grew a little taller. The ante having been upped, others would have to follow suit.
Nothing can stop the whole game escalating until all trees are ludicrously and wastefully tall.
It is ludicrous and wasteful only from the point of view of a rational economic planner thinking in terms of maximizing efficiency. But it all makes sense once you understand the true utility functiongenes are maximizing their own survival. Homely analogies abound. At a cocktail party, you shout yourself hoarse. The reason is that everybody else is shouting at top volume.