But also consider: in the long term, higher gas prices due to supply shortages encourage companies to drill for and produce more oil -- because they are getting the profits. But higher gas prices due to a carbon tax have the opposite effect -- the buyer is paying more, but that's because the producer is paying the tax, and passing on some or most of that cost to the buyer. They aren't making more profit, but less -- reducing their incentive to pull more oil out of the ground. So that's something powerful that a carbon tax does that inflation doesn't.
And inflation is (ideally) a temporary thing, and variable. A carbon tax is intended to be permanent (and ideally, slowly and steadily increasing), something predictable and inevitable that people can plan around. You'll act differently if you think gas is going to go back down by 20% than if you think it's going to stay at the higher prices forever, or keep getting more and more expensive over time.
My understanding is that even the possibility of a future carbon tax has caused some companies to start reducing their fossil fuel dependency, because if a tax happens, they'll be in a better place than if they did business as usual.
It probably helped a little, temporarily, but it probably helped a lot less than a carbon tax.
Imagine if anything that runs on electricity was immune to the inflation. That's closer to what you'd get, though still very different in other ways.