I think that the origin of the problem is a litte another as you described. I see the main problem is that .trigger('click') follows to call of populatesubgrid, which use test for ts.grid.hDiv.loading (see the line of code) like in the most other places of jqGrid where $.ajax are called. In the next line the property ts.grid.hDiv.loading will be set to false and so some other .trigger('click') will be just skipped.
You can find description of the same problem here and here. At the moment as I wrote the answers I don't knows a good way to solve the problem. Later I though to place ids of all requested nodes which needed be expanded in one array and to start new Ajax request at the end of processing of the previous one. I though to itarate in the way till the array of ids which should be expanded will be empty.
Later I think there are much better way to solve the problem. Look at the answer, which describes close problem in case when one need to expand multiple tree nodes directly after loading of the TreeGrid.
Currently jqGrid send to the server id of the expanding node as the parameter (the default name of the parameter is id, but can be configured by prmNames.subgridid jqGrid option). I find the best to allow to send array of ids of all nodes which need be expanded in one Ajax request. One should change a little the processing of the response in subGridJson and subGridXml, but it will be easy enough. In the way one could not only solve the problem which you describe, but improve the performance by reducing of round trips.
Actually, I believe that my problem is not quite the same as ones described by you. I debugged jqgrid code and was able to see that the reason is quite simple – triggering 'onClick' event on a wrong row (subgrid row instead of next "parent" row).
The code which fires that event does not check if this is right row – that code is out of condition