"Why is “dark matter” theory accepted? Why wasn't general relativity rejected?"
The concept of dark matter has innocent beginnings. Literally, it just means something that doesn't emit light. When people first started trying to explain anomalies in terms of dark matter, they were thinking in terms of things like dead stars or lots of neutrinos, that could or should be out there, even according to a highly conservative physics.
Nowadays the standard theory of dark matter is that there's some unknown particle, that doesn't interact much with anything, and which exists in enormous numbers in a spherical shell around every galaxy, and the gravitational influence of this dark matter "halo" is the cause of the anomalous galactic rotation curves.
The simplest forms of that theory of dark matter, really are very simple. You may have heard of the standard model of particle physics, which is defined by an inventory of fundamental particles, their interactions and their other properties. That theory was built up in response to observation. Physicists had to deal with the fact that there's more to reality than proton, electron, electromagnetism, and gravity; in the end they had to add (among other things) quarks, neutrinos, and three "generations" of fundamental particles even though only the first generation is needed to make atoms.
Given that new fundamental particles have repeatedly had to be introduced, it's really not a big step to just add one or two new types of particle to the standard model, that are inert with respect to the known forces except gravity, and which are produced in enormous quantities in the early universe.
The simplest quantitative theories of dark matter are exactly like that, and apparently they fit the observations. So you especially can't fault such minimalist theories of dark matter, as being an abuse of the scientific method. They are highly conservative extensions of theories we have already been driven to adopt. The same can be said of field-theoretic models of dark energy, such as "quintessence". You observe something, accelerated expansion; you add one more fundamental field to your fundamental equation; and the observation is accounted for.
It's true that, although these minimal models exist, and astrophysicists and cosmologists know about them and regularly test them against new data, the emphasis in the world of theory is on much more elaborate constructions. The dark matter particle may be just one of a multitude of "superparticles", the dark energy is a "vacuum energy" containing contributions from many fields, etc.
These more elaborate constructions, like supersymmetry and string theory, are not driven by astronomical observation. They are driven by an attempt to distill the complexities of particle physics into something with fewer postulates than the standard model, and by attempts to solve the internal problems of theory, like the quantization of gravity. They typically predict that there are a lot of new physical phenomena not yet observed, and so these theorists do tune their models in order that some part of the model can explain the astronomical anomalies. But these paradigms are principally motivated by particle physics considerations, and so if your interest is mostly cosmological, they may leave you cold.
The alternative approach that you favor - modify the theory of gravity - does also exist, in both the forms I mentioned (bottom-up minimalism and top-down high theory). MOND is the main minimal approach; and string theory can certainly provide a high-theory approach, e.g. by adding the dilaton to the graviton. Evidently theories of dark matter get the majority of the attention, but theories of modified gravity are also still being developed and studied.
A real answer to your question would try to go through all the specific observations and the specific theoretical options, and explain why dark matter is more popular than modified gravity, but not decisively so. But there are many review papers that cover those topics, at a level detail that I can't. Instead I just wanted to sketch the overall theoretical situation so you can see its logic.