Notice: Vanilla Bannerlord now has a much better way of replacing troops, provided you are willing to use XSLT. You should use them in place of this hack, which was produced back when XSLT wasn't really a thing in Bannerlord early access.
Custom Troops Upgrade and Replacer Mod - allows troop upgrade paths to be added and removed without having to modify troop XML files, and allows overwriting of existing troop with new ones without issues that arise from overwriting troop XML files.
Nexus link: https://www.nexusmods.com/mountandblade2bannerlord/mods/712/
Documentation: https://github.com/Designer225/CustomTroopUpgrades/wiki
- There is a maximum of 2 upgrades per troop. Any more than that will cause distortions on the troop's encyclopedia page, and will cause a game crash when attempting to access that troop's upgrades. The only known workaroud is to delete an existing upgrade first, then add your upgrade in.