My understanding is that once you start the engine, basically, you can ( don't do it!) disconnect the battery and the engine will run, forever.
Once running, a normally operating alternator will generate all the power needed to run the vehicle, and provide it's own excitation. It's not a perpetual motion quandary, as the engine is providing the energy, burning gasoline, to spin the alternator rotor.
The issue is that the alternator output has lots of ripple, which modern electronics don't tolerate well. Injectors, ignition coils, pumps and solenoids have relatively large current demands and generate lots of current transients on the 12v power buss. The battery performs critical smoothing of this ripple, and does so until its internal resistance gets too high, typically correlative with hours in service, number of deep discharge/charge cycles, extreme cold & heat, etc. When the internal resistance, or post connection resistance gets too high, the ripple can be large enough to cause module or sensor malfunction, and subsequent drivability and stall issues. The tired battery may have enough reserve to start the car, but the electronics may not be happy when the vehicle is running.
Further, many modern charging systems depend on a good battery to supply ALL the vehicle power needs for short periods, reducing charging current and engine load, both to manage the battery service life better and for fuel savings. The PCM lowers the charging current, where the net current flow is from the battery reserve.
In cases like the OP, it may not have been the battery itself, but the post connections that haven't been disturbed in 5 yrs and have 5 yrs of battery acid fume exposure. Those connections, of course , are disturbed and usually improved when one installs the new battery.