Way to Leave an Army
To leave any army, you can just kill all the NPCs.
For Ye Family, you are given the option to quit by Duke Kang who ascended the throne after the general is sentenced to death.
For the General, I’ve read you can bring the injured monk in your party and speak to the general. I’ve never tested this myself.
For the Yan Army, depending on your definition of “leaving an army”, you can drink the poison in the end.