Inventory management would be a nightmare though, considering the range of physical dimensions, weight, battery specifications etc. Often none of these things are standard even across a single model range let alone the entire industry. When the batteries are often over 1000lbs and large, it’s difficult to carry a range of spares. I’d imagine it also might be a pretty tough job even in the easiest cases for a single roadside mechanic to perform, given the sizes and weights involved.
There’s also the thorny issue of battery health - what if the replacement has more or less charge cycles than the existing battery? This can materially affect the resale value of a vehicle. At least cellphone batteries were tiny and cheap.
The Tesla Model S 100kwh battery is about 1300 lbs, and it's a structural member of the car, so removing it is not a quick operation. That's about 25-30% of the weight of the car, just for the battery. The battery essentially is the floor pan.
Even an 100 mile battery would still weigh something like 400lbs (plus the weight of the support brackets/frame), and it's hard to put that somewhere in the car where it can easily be swapped, and also not make the car handle poorly.
look at smartphone and laptop batteries now compared to 10 years ago. battery swapping used to be a thing when companies were cool with right to repair and independent shops fixing products; not so much now. look up louis rossmann and the way apple dealt with him (spoiler sending customs to take everything under the guise of using fakes)
He's developed carbon only batteries/supercaps that beat Lithium ion batteries by something like double the capacity. Some of what he is working on can be overcharged at high voltage and the cell comes to capacity in a very short amount of time.
A DC-DC transfer would enable fast charging rates with relatively compact and lightweight equipment. A diesel generator that can output, say, 100kW continuously is pretty big and hefty!
Also, by nature, most "ran out of charge" incidents will happen near a charger (or near home, etc) because the driver thought they could make it. It's not likely that someone would drive off into some really remote area with no idea of where they would charge the car.
An alternative would be an SMR (and possibly a bank of caps) but I don't think any of the currently working or even close to working designs would fit on a regular trailer (the KLT-40S seems to be the lightest working SMR at 80t with water, the rest is 150~1500t).
A 10 minute charge and you'd have topped up the stranded vehicle with 16kWh, enough for 50 miles or so travel to get home or to the nearest fast charger. And you'd still have plenty left in the pack in the unlikely event of further callouts.
[^] (Modern EV packs already have significantly higher energy density than the old 85kWh Model S, by the way).