Federalist 10 (James Madison) does pretty explicitly state this. It seeks to explain how the proposed US Constitution protects against one of the key problems with representative government -- that of faction (aka, what we would call parties today). The tyranny of the majority is described as follows:
> When a majority is included in a faction, the form of popular government, on the other hand, enables it to sacrifice to its ruling passion or interest both the public good and the rights of other citizens
And the remedy provided by the indirectness of the American system (i.e., election of representatives, senators, and electors instead of direct democracy) is that it will
> refine and enlarge the public views, by passing them through the medium of a chosen body of citizens, whose wisdom may best discern the true interest of their country, and whose patriotism and love of justice will be least likely to sacrifice it to temporary or partial considerations. Under such a regulation, it may well happen that the public voice, pronounced by the representatives of the people, will be more consonant to the public good than if pronounced by the people themselves, convened for the purpose
Generally I recommend reading this whole paper, 18th century prose aside, as it provides a fascinating insight into how the framers thought of some of the key points of the Constitution
https://billofrightsinstitute.org/primary-sources/federalist...