The court isn't telling all 50 states what to do.
It's telling them what to STOP doing, which is stop banning gay marriage and unjustly and unconstitutionally violating the rights of a segment of the populace.
Actually the court is telling all 50 states what to do. The states laws generally defined marriage as between a man and a woman. To the extent that there were actual bans it was in essence a clarification of policy or defensive measures. That is pretty simple to understand. But in this case the court is telling the states that they have to expand the definition to include other possibilities than just a man and woman.
And the democratic process angle is bogus, besides being essentially the same argument the South eventually went to war over.
Civil rights and freedoms cannot be left to popular vote. If we did that, the histories of slavery, jim crow, and interracial marriage would have been a lot different...specifically longer lasting.
Slavery was ended by amending the US Constitution. That was done by votes, not decree. Jim Crow and the associated nonsense was ended by a combination of laws passed by Congress (with Republican support against the Democrats running the segregated South), court decisions, and executive actions such as the use of the Army to enforce court orders or policy by Presidents Eisenhower and Kennedy.