I understand the honour side of it, and that it stopped revenge killings, but surely a lord would have a lot of samurai loyal to him, so it would be a lot of people killed unnecessarily, and couldn't they just start serving the eldest son? Why would they have to kill themselves when they could stay alive and stay loyal to their master's family line?
The vast majority didn't. While not ruling out a handful who might genuinely have wanted to loyally follow their lord in death, most who did commit seppuku after a military defeat (including the lord), ignoring a negotiated end, likely did so because there was no possibility of escape and they would've been executed after capture anyway.
See our FAQ section on seppuku here.