On Trnasfer switches.. What they do not tell you....
THey are not designed to transfer INDUCTIVE Loads such as air conditioners.. When you transfer an inductive load.. HOT, the instant voltage can easily spike to 1,000 volts or more.. This can cause Arc-over of the contacts on the Contactors and weld the relays in one or the other position.
So it was not likely the return of shore power. but the transfer from generator to shore that did it when you shut off the generator.
Suggestion is to always shut off power BEFORE transferring, either by turninf off the MAIN breaker in the RV (Works both ways) or by turning off the park breaker.. wait 3 minutes before restoring power.