The point is that gravity, when combined with a model for the contents of the universe, provides a very specific prediction for the relationship between redshift and distance (among a great many other things which I won't go into here...). If we assume that normal matter plus dark matter are the only contents in the universe, we get the wrong answer. Clearly this means one of two things:
1. Our model of gravity is incorrect a very large distances (potential solution: modified gravity).
2. Our understanding of the contents of the universe is incorrect (potential solution: dark energy).
Both are being investigated.