A way to prevent players from leaving a guild is to implement a scoring system for when a raid starts you earn pts based on the energy you participant in the raid, in return you can also see who is loyal in raids, when u leave guild you lose score and start over or u can continue where u left off with that 2nd guild.
Example: I wasted 1,256 energy with Guild A, left to join Guild B and wasted 657, left Guild B to join Guild A again my 1,256 continues where I left off
Example: I wasted 1,256 energy with Guild A, left to join Guild B and wasted 657, left Guild B to join Guild A again my 1,256 continues where I left off