As someone with a long-standing interest in physics and cosmology, I don't think this is accurate. I probably read 2-3 "hard science" books about these kinds of topics every year, and my understanding is that dark matter was not simply invented to make certain equations balance. There are decades of observations that show most (maybe all?) galaxies have too little ordinary/visible matter to hold together and spin as they do. Dark matter, whatever it is, is the missing stuff that interacts gravitationally with ordinary matter so that galaxies and other supermassive structures (like galaxy clusters, filaments, etc.) coalesce, hold together, and stay gravitationally bound. I would say that the existence of dark matter (albeit not its precise nature) is as well-established and accepted by physicists today as is the existence of, say, black holes. Neither can be directly observed, for various reasons, but their existence can be inferred with high confidence using standard, well-established methods of observation, experimentation, and theoretical analysis. This kind of indirect discovery happens all the time in science and doesn't equate to simply "inventing" things or coming up with "fudge factors" just to make equations balance.
Dark energy, on the other hand, does fall
slightly more into the "fudge factor" realm, although just slightly so. But that's a topic for another day.