Hence the massive war machine of the UFP still isn't enough to deter all sorts of upstarts like Talarians or Cardassians from making offensive moves - but when the Feds get fed up with that, they can end the nonsense with a very short and very decisive offense.
Herein lies a key point. Whenever we discuss wars between the great powers on this board, we always assume we are talking about a no-holds barred total war along the lines of WW2.
What seems far more common is the Federation gets involved in little border skirmishes with races that in a WW2 scenario it could cream, but who do not justify the resources, blood or treasure to fight a total war.
A real world parallel might be Japan in WW2, who never stood a realistic chance, despite large capable military forces, of defeating the vast economic power of the USA. Despite this defeating them in a total war took a massive naval force, thousands of lives, a Russian invasion, a firebombing campaign and two atomic bombs. The Federation would never resort to the two latter measures, and would prefer a negotiated peace to any of the former.
The Talarians are a great example, I didn't get from the episode that the Enterprise has much to worry about from even three Talarian ships, it would easily defeat them. A small Federation fleet could probably effectively contain their entire military. The Cardassians are again simply a larger example, no match for the Federation in a total war but capable of an effective border campaign to win territorial concessions.
On paper, the US military was vastly superior to the North Vietnamese and their allies, but was still eventually forced to withdraw, due to domestic pressure and a failure to bring a timely end to the conflict. While eventually a revived US military might have won in Vietnam, it was never worth the cost in blood or treasure to do so.
So, in the Trekverse, throughout TNG we see constantly the same thing, on topic, I suspect the Federation has a superior economy and larger fleet than the Romulans, but this would only come into play in a total war. In a more limited campaign to take a few systems and move the neutral zone 50 light years closer to Earth, the Romulans would stand a fair chance of achieving their goals.