The Cardinals not selling at the trade deadline would be a bad idea
While adding some players that could help the team next year and beyond is a perfectly reasonable course of action, the Cardinals still need to treat the 2023 deadline as primarily sellers. Here is just the reality: the rotation is not going to be fixable with one deadline's worth of moves. The quality on the market just isn't there and even if they do spend all of the resources needed to grab multiple quality rotation arms, it is still highly unlikely they would be enough to make up this much ground.
If the Cardinals were a bit closer in the standings and there were some really marquee rotation arms available, the decision calculus would be different. However, Max Scherzer and Justin Verlander are the guys that are potentially available with the best track records, but both have been pretty rough this season and are owed a TON of money. Shane Bieber is another guy that has been awesome in the past, but he is trending in the wrong direction. Eduardo Rodriguez is probably the guy that is going to be in demand the most, but we don't even know if he is going to be healthy at the deadline or if the Tigers will trade him at all.
It is simple cost/benefit analysis here. Being true buyers at the deadline just isn't likely to do much for their playoff chances. However, selling players like Giovanny Gallegos, Jack Flaherty (more on him in a second), Jordan Montgomery, Tyler O'Neill, and/or Dylan Carlson could stock the Cardinals up with young talent in a sellers' market and provide clarity to their plans for next year.
The Cardinals need to trade Jack Flaherty at the deadline
We mentioned Jack Flaherty as a guy the Cardinals need to consider trading at the trade deadline, but the reality is that the Cardinals need to trade him. We'll gloss over the fact that he has dealt with injuries in recent years and has been bad this season. The biggest reason that they need to trade him now is because if they don't, it is very likely they will get literally nothing out of his exit from the organization.
There is a case at least to be made for keeping Jordan Montgomery because placing a qualifying offer on Montgomery when he hits free agency is likely to net the Cardinals a draft pick. However, Flaherty has struggled enough that giving him a qualifying offer seems very likely to result in him signing the offer, committing the Cardinals to a significant amount of 2024 money to a guy that isn't producing enough, and then him walking after next season and St. Lous gets nothing. Trading Flaherty now is the only sensible path forward and if he is still on the roster after the deadline, it will be purely a loss of value.