Well, she may have outsmarted the trapper or trap designer, LOL. She basically brute forced broke the code, so to speak. Brute force tactics don't require a lot of mental power.
I think the claim for empathy being in hogs is a bit of a stretch, either that or empathy is not as special or unique as may be implied given that it has been documented in a variety of species, for example that might engage in rescue behavior. For example, here is one turtle rescuing another turtle. Is it empathy or instinct?
That a mother hog may rescue her own young further complicates the argument for empathy because it is instinct for mothers of many many species to protect their young. The authors' interpretation of empathy because of piloerection (bristling of the guard hairs) as being a sign of distress is very selective. Piloerection is an involuntary contraction of the muscles under the hair follicles that can come about as a result cold, shock, fright, aggression, excitement, arousal, etc. In other words, the juveniles may have been in distress and she experience piloerection not because of her empathic capability to understand the distress of the the trapped little ones, but because she was angry that she could not free them. In short, piloerection is not diagnostic of distress. Case and point, a boar screwing a sow, aroused, with piloerection.