94 Dodge ram 4x4, runs super rough.

I tend to agree with the o2s being the problem but

Firstly, most of those old systems, with un-heated O2s, have a pre-programmed cold-start map, and the engine runs on that until the ECU sees a certain coolant temp. This was called open-loop because the O2s were not in the loop.
Then, when the magic number comes up in the coolant sensor, the ECU switches to closed loop and the O2s run the show, with the ECU making second by second, short-term corrections. If the computer makes the same old corrections over and over, it throws some of the correction into a long-term correction.
Now, while this goes on day after day and the miles pile on, the computer is keeping track of all those corrections that it has been giving.

They call this a speed-density system, because the two major players in the fuel maps are ; engine speed, and oxygen density. So the rpm sensor is the first go-to, and the load sensor is the second; the load-sensor sensing manifold vacuum. The ECU reads those first, then checks it's pre-programmed map to determine how long to open the injectors. Then it checks the long-term trim, and adds that in. Then the short term trim, and adds that in. While you were cranking the engine, it checked the baro-sensor, and that correction is continuously added. Of course it is also continuously monitoring the temperature of the coolant and the inlet air, and making corrections for those. Finally with all the corrections added up, it opens the injectors and immediately checks the O2s to see if it did a good job.
If the Ecu figures it made a mistake, then on the next go-round, it makes another correction.
You can see this on the scanner as the O2 is continuously switching from rich to lean in response to the oxygen content.
Ok but hang on; what if oxygen was getting into the pipes ahead of the O2s and corrupting the reading? Heckya! If you have an exhaust leak, chances are,not only is exhaust leaking out, but atmospheric air is also leaking in; which is 21% oxygen.. Check it out. I bet the trans shop dropped the exhaust ..................

So if you disconnect the battery for a period of time, the computer loses the records of these trims. So it has to start all over. So it takes TIME, in the form of driving cycles,, for the computer to re-establish the trims. Eventually, it will sort it out. Well as long as the O2s and CTS are working, it will.

If you put a scanner on it, you can read in real-time, what the O2s are doing. My cheapo tool even graphs them. The scanner can also read all or most all your major sensors.