The judge presiding over PG&E Corp.’s bankruptcy handed shareholders a loss, opening the door to a competition over the best path out of bankruptcy that pits the troubled utility against bondholders led by Elliott Management Corp.

Judge Dennis Montali of the U.S. Bankruptcy Court in San Francisco cleared the way for a rival chapter 11 plan from Elliott and other bondholders that are allied with victims of wildfires that drove PG&E to bankruptcy. His ruling stripped PG&E of the sole right to propose a chapter 11...