There is always an official executioner. If you try to take his place, It is like trying to be a master carpenter and cutting wood. If you try to cut wood like a master carpenter, you will only hurt your hand.
In the great majority of cases the context alone will suffice to show whether "what?" or "who?" is the more apt translation of ko. In your second passage, for example, clearly "What?" is needed, for the answer to the question is a mode of behaviour, not a person.
In cases where either translation might arguably make sense, the translator will probably base his decision either on (1) His knowledge of typical/natural ways of framing questions in sutta usage; it will sometimes happen that one of the two options, though semantically possible, would amount to an inelegant or unnatural way of phrasing the question; (2) His knowledge of Buddhist doctrine.
In the case of your first passage, if "What?" were used in place of "Who?" then it's hard to see why it would be an "unfit question", for elsewhere in the suttas we do find the Buddha saying things like "contacts contact," "feeling feels", etc., and so it would actually be an easily answerable question.
There is always an official executioner. If you try to take his place, It is like trying to be a master carpenter and cutting wood. If you try to cut wood like a master carpenter, you will only hurt your hand.