the banners are getting assigned to the lords via the operation (troop_set_slot, ":kingdom_hero", slot_troop_banner_scene_prop, ":banner_id"),
This is basically the operation which you need to reuse for the same slots to reassign the lords a new banner of the respective faction. Be aware however that in theory a faction could have more lords than it has factions available, in Native there is one big texture sheet with 18 (?) banners per faction iirc. You would need to find a workaround here or have enough placeholder banners for each faction at hand.
Right so if I understand well you are talking about the situation in which the lords use their own banner, in order to make them use their faction's (→ liege's) banner? But in the case they already use the same banner as their faction's leader, is there a way to make that script run again when they renounce to their current faction and join another - including the player's newly created kingdom? i.e. they have let's say the Swadian 'national' banner, and so they adopt the Vaegir - etc. 'national' banner if they get indicted or renounce to the Kingdom of Swadia and then join another faction, or even the player's kingdom 'national' banner (?)
You first need to explain how your bannersystem works or is supposed to work. Do you have one banner per faction? Or does every lord have his own individual banner? Depending on that the solution might be easier or more complicated.
Then you have the script which determines the chance of defecting per lord. There you add lines in which you also check for the new faction to which the lord defects and assign to him the banner of the respective faction as new banner. The easiest solution which comes into my mind.