i had an idea on how to do this (only in GAE), you make a "commander" of sorts who can build stuff, and everything he builds, he builds as a "pet". then, when it comes to buildings like the barracks, all of the units would be "pets" as well. this would essentially become a large tree of pets and parents, all ending at the commander. when he dies, so does everything else...
also, in any way that this is accomplished, the king should have an attack of some sort (to defend himself). this could be a weak attack, or the king could be the most powerful infantry unit in the game (ever played Total Annihilation or Supreme Commander?). but either way, when he dies, its "game over"