The definition of democracy is that we hold regular elections for political office. It does not mean that every single decision in society is up for a vote at the local level. 51% of my neighbors cannot decide that they'd like expropriate my house or checking account. The point of YIMBYism is that these kinds of decisions have negative externalities and a larger group of voters- at the state or national level- are removing that decision-making power from a smaller group at the local level. This is a democratically legitimate outcome!