Swapping parts and cannibalizing is way more common than most people would be comfortable with. Sale of parts from retired aircraft before they are cut up is a robust business, and if properly tested and certified and pedigree tracked happens every day. There are reasons for taking a good part from a plane and putting it in another. If a plane isn't going to fly for any one of many reasons, taking a working part might not be unreasonable if you think the defective can be repaired or replaced before the donor is going back in service. Also, depending on levels of redundancy, a part "loan" may result in an airplane complying with a minimum equipment list while not grounding the other. Any of this stuff requires an operator or maintenance organization to maintain strict tracking and oversight standards, that is often a failing point.