I’ve heard that those who die before the age of accountability do so because they are so perfect they don’t need the experience of mortal life. As most people die before the age of accountabiity and many people in the Millenium grow up without sin there are really very few of us who have to be accountable. Does this mean than those of us who have to be accountable are the worst. It is my understanding that only about 20 to 25 percent of us are accountable. That would put us in the bottom quarter of Heavenly Father’s children.
The honest truth is we aren’t certain why children die before becoming accountable for their actions. For some suffering parents, perhaps the idea you explained is how they cope with the horrible loss they are facing. Perhaps in some cases it is the truth. I doubt that it is as common a situation as you are expressing. For my part I believe that much of the time it is a consequence of the world in which we live. Our bodies are imperfect, and that includes children who are taken from this life for no apparent medical reason.
In the case of those who die due to violent means, they are the results of others using their agency to a tragic end, whether intentional or accidental. It is a situation we were likely made aware of before we came here, and I assure you it is a situation Heavenly Father was well aware of before he sent any of us here to begin our lives.
As to where we rank in righteousness of Heavenly Father’s children, I simply suggest putting away the math tools. We have no idea how many spirit children Heavenly Father created. Because of that, there is no way to measure where this current generation even ranks in percentage as a whole, much less where we rank in righteousness. To suggest that we are the least righteous is to contradict what the prophets have told us for decades, if not from the time of Joseph Smith himself.