Let me share some generalities. Poor battery condition increases demand on alternator and can shorten lifespan of alternator. How much is a case by case thing - depends on age of alternator and capacity. Battery terminal issues such a loose connections and corrosion count against battery condition.
A poor performing alternator will shorten battery life as battery life is a function of charge condition over time pure and simple. A battery that's maintained at 65% charge condition will not last as long as a battery that's maintained at 90% charge condition. Temperature and load also play a factor, but let's not coufuse things with that.
Battery condition and alternator condition are therefore related. In many cases, a poor alternator over time will cause premature battery failure. So, one replaces battery only to have the new one live a short life due to poor charging condition.
Conversly, a poor condition battery will place increased load damands on the alternator and can cause premature failure of the alternator.
What I'm saying is many times both need to be replaced. When replacing alternator the battery should be fully charged using an external battery charger and then load tested to be sure it's ok and not damaged from a crappy alternator that the performance deteriorated over time taking life out of the battery. When replacing battery, the alternator should be removed and load tested.
I've read several times over the past few years that major chain store aftermarket alternators that have a lifetime warranty are junk. I used them for years and trashed a couple of good Optima batteries using them. They are junk.
I still use Optima batteries but now run an aftermarket 160 amp alternator. Much better, lights are brighter in the car, ignition fires better, fuel pressure is better as battery charge condition is maintained much better. This will extend battery life and I don't have to replace the alternator once a year or so.
I've read the OEM alternators are also good ones, although expensive.