How do we reconcile the Torah's viewpoint that punishments make Jews better with what we see that punishments push Jews away (and rewards make Jews better)?
The Gemara says that Mashiach will come if the Jews are all righteous or all wicked.
The Gemara asks how could Mashiach come if the generation is all evil, so the Gemara says that Hashem will place a leader over the Jews similar to Haman, and the Jews will all do Teshiva like we did in the time of the Megilla, and we will merit the redemption.
Moreover (in a more general way), we see that Hashem promises to bring punishments on the Jews if they disobey. These punishments are there to help the Jews do Teshuva. These two points show that according to the Torah, Bad times for the Jews leads to Teshuva.
Yet, in our time we see the opposite happening. When times went bad for the Jews (in the times of the Czar, Stalin, and Hitler), Jews went progressively worse. Jews were generally religious until the late 1800s. In Russia, as a result of the oppression, many Jews became Communists and many converted altogether. When Stalin came, many Jews who still stayed religious left Judaism (they didn't do Teshuva, they just left out of fear). When Jews came to America (and were in general poor and were at least somewhat oppressed), they stopped being religious to work on Shabbos.
Moreover (and especially) after the Holocaust, most survivors stopped being religious completely (if G-d exists, where was He when I was in .... ??!!)
However, lately we started seeing another pattern. As Jews started feeling better, they stated being religious. After the victory of the six-day war, many people started coming back to Judaism. After Jews (in general) became more financially settled, people started coming back to religion.