Actually, things like this did happen. Several locos were captured and repainted with names more appropriate to the capturing side. For example, in 1862-3 the Mason Locomotive Works of Taunton, Massachusetts delivered seven engines to the newly organized U.S. Military Railroad in Virginia where the engines were immediately put to work at the hazardous task of supplying the Federal forces. In August, 1862, Confederate troops under “Stonewall” Jackson captured several locomotives, including Mason’s D.C. McCALLUM, named for the military commander of the USMRR. The engines were quickly hauled off as loot and leased by the Confederate government to southern railroads. The Richmond and Danville RR, an important link in the southern system, acquired the D.C. McCALLUM and renamed it POCAHONTAS, using it until the end of the war.
Similarly, when BG Haupt left military service over a squabble with the Secretary of War, the engine named after him was repainted to Robinson.