We’re using a lot of different definitions of ‘ideal’, which is good, options are important. I think the two people look at the most are quality (where we have the maximum possible nutrients) and cost per calorie. We’ve also seen that they two tend to be wildly divergent, and even some of the best are subject to limitation of use by scarcity/cost. If we go with conventional thinking, then some form of bean/legume is probably the best compromise, as it could be provided world-wide with high bang for buck.
But, and I say this not to be gross, but for future thought - should we consider cannibalism? Now yes, I agree that right now religious, cultural, social and moral (to the extent that those are different) realities would prevent any such discussion, but we should consider it.
Human protein is pretty much by definition, as biologically suited to us as any animal based meat source. Most of our sources are self-supporting, and we already have the issue with long term storage of human remains - whether we soak them in toxic chemicals and stick them in what would otherwise productive landscape, or create additional carbon waste by burning them.
If it could be handled ethically (and that’s a huge IF) perhaps as we do with organ donors, and the practical considerations were evaluated without the social cost (an almost impossible assumption), I think this would be the most ‘ideal’ source of protein for the world population, and would allow a substantial decrease in farmed domestic animals in the long run. Do I think it will happen? Well, I’ve watched Soylent Green more times than would be healthy, and it looks more predictive than not in the last few decades…