R' Gil Student in a TorahMusings.com article titled "Medicine on Shabbos" says that your question is "an excellent question that the greatest halakhic authorities of recent times have asked" and cites sources who proceed to offer two approaches:
1) Maybe it should be permissible today!
R' Avraham Chaim Na’eh (Ketzos Ha-Shulchan 134 n. 7.2) considers the [...] logic to permit taking medicine in pill form on Shabbos. Since the rabbinic concern for grinding no longer exists, perhaps the prohibition no longer applies. He bases his argument on the Rema (Orach Chaim 339:3) who, quoting Tosafos (Beitzah 30a sv. "tenan"), permits clapping on Shabbos because we are no longer concerned that this might lead to fixing a musical instrument. Once the reason for the rabbinic decree ceases, the prohibition falls aside. However, because there are still some people somewhere in the world who grind herbal medicine (at the time of his writing and still today), R. Na’eh was not willing to rule leniently.
2) Tzitz Eliezer: Rashi would say the prohibition is still intact today, but maybe the Rambam would say the prohibition no longer applies today?
R' Eliezer Waldenberg (Tzitz Eliezer vol. 8 15:15) takes a different path toward leniency. He argues that two general approaches exist to the prohibition against (non-essential) healing on Shabbos.
a) Rashi (Shabbos 53b sv. "gezeirah") believes that the Sages enacted a general prohibition against any type of healing on Shabbos.
While the underlying concern was grinding on Shabbos, the prohibition itself is not directly related. [...]
Similarly, Rashi (Shabbos 111a sv. "aval") explains that a person may not anoint with rose oil because they are clearly doing it solely for medical purposes.
None of these examples involve a concern for grinding medicine but are still forbidden because of the general prohibition.
b) The Rambam, on the other hand, (Mishneh Torah, Hilchos Shabbos 21:31) permits certain acts of healing, implying that the prohibition was specifically against taking medicine to treat an illness that is generally healed with privately ground medicine.
Even if you do not grind the medicine, taking it is forbidden because grinding is generally involved in treatment.
Putting this together:
According to Rashi, the change in medical technology does not undermine the general prohibition of the Sages. While they may not have enacted such a prohibition today, their ancient enactment remains in force.
However, according to the Rambam, this enactment is specifically about grinding medicine on Shabbos that you normally grind during the week.
Since we do not personally grind medicine anymore, the prohibition should no longer apply.
R' Waldenberg is cautious because some people do grind homemade remedies and because there are other interpretations of the Rambam’s position. He therefore decides to be as lenient as possible without being entirely permissive.
The article continues and subsequently crosses over into territory that is addressed in the question:
"Is clinical depression medication allowed on Shabbos?"