To my eye, WAG has had a lot of issues, some internal, some external.
On the internal side, as you note, they just overbuilt in world that no longer caters to bricks and mortar. (Interestingly, I thought we were really going to see the power of that distribution asset during Covid in terms of vaccine administration, etc., but it just never really materialized.) In addition, they seemed to reach our to way too many "adjunct" business models to get a greater place in the health care space, when all of the incentives around integration favored hospital based systems, and most of them have failed pretty spectacularly. (E.g., minute clinics, and who could possibly forget the disaster with Elizabeth Holmes and Theranos.)
Externally, they have a more diverse and powerful group of competitors in the big box world and in the online world, and pbms have cut pharmacy margins to the bone. And recognize that the Inflation Reduction Act's "negotiated pricing" provisions are going to kill pharmacies -- while the incremental discounts associated with the first ten drugs are relatively modest, the real impact of the program is to require that the discounts be passed through and made available to patients at the point of sale. In other words, that's a good thing for patients, but say goodbye to whatever profit margins might have been available to pharmacies for the ten biggest medicare and Medicaid drugs on the market (cause they sure aren't making their numbers based on dispensing fees).
Note also that as stores close, their leverage with PBM networks gets even weaker as the 'local/regional go to" for employees of the benefit plans the pbms administer on the private side. Vicious cycle.