Sorry about the delay in replying. I am on travel and in a different time zone as well.
The sutta that you refer to require setting up the background. I think there was a discussion on this topic in an old thread here. But I don’t have time to look for it right now.
Let me give a brief outline.
King Yama is one of many “judges” in the nirayas. They are like our judges in a way.
People who have done clear-cut bad deeds automatically are born in the appropriate nirayas.
– However, when there are “borderline cases” that are sent to these “judges” like “King Yama”. Those judges interrogate such persons and make a determination whether they should be “saved” from the nirayas.
“messenger of the gods” referred to in the sutta refer to the advice from the Devas”.
– Devas always want humans to do good and be born among them.
– Those who don’t heed such advice engage in bad deeds and are unable to avoid births in the apayas.
That is essentially what is meant by “messenger of the gods” that King Yama referred to.
There are many things about this world that we are not aware of. It is not worthwhile to look into fine details.
– The Buddha described such scenarios to warn people about the price they will have to pay if they engage in immoral deeds.
– There are some graphic details about the sufferings (torture) in such nirayas in this and a few other suttas.