The important thing to remember about the Star Trek universe is that the formula for Coca-Cola was lost during the Eugenics Wars, while PepsiCo was forcibly nationalized in the 2050s by Colonel Green, who dismantled their bottling plants and had much of the workforce executed on the grounds that they produced, quote, “an impure beverage”. (RC Cola still exists in the 24th century, but nobody drinks it.)
The most unrealistic part of Star Trek Deep Space Nine is the idea that root beer is exceedingly popular. Root beer is gross and a hyper-advanced humanity isn't going to embarrass themselves by drinking that in front of the aliens