Luis De Molina is often called the inventor of the idea that God knows what we would choose in any setting. But Molina’s role is really more of a systematizer and defender of this idea, rather than inventor. Of course, the idea is in the bible itself (link), but it’s also in some of the Church Fathers. For example, Gregory of Nyssa uses this idea to theorize why God allows infants to die. Now Gregory’s use is somewhat speculative and may not be all that helpful to grieving parents (“Oh great, not only is my kid dead, but he would have grown up to be a Hitler…”). So I don’t bring this up to sign off on Gregory’s theory, but rather mealy to note the use of the idea in the Fathers, well prior to Molina’s time. Here’s Gregory of Nyssa’s comment:
"It is a sign of the perfection of God's providence, that He not only heals maladies that have come into existence, but also provides that some should be never mixed up at all in the things which He has forbidden; it is reasonable, that is, to expect that He Who knows the future equally with the past should check the advance of an infant to complete maturity, in order that the evil may not be developed which His foreknowledge has detected in his future life, and in order that a lifetime granted to one whose evil dispositions will be lifelong may not become the actual material for his vice. We shall better explain what we are thinking of by an illustration.
Suppose a banquet of very varied abundance, prepared for a certain number of guests, and let the chair be taken by one of their number who is gifted to know accurately the peculiarities of constitution in each of them, and what food is best adapted to each temperament, what is harmful and unsuitable; in addition to this let him be entrusted with a sort of absolute authority over them, whether to allow as he pleases so and so to remain at the board or to expel so and so, and to take every precaution that each should address himself to the viands most suited to his constitution, so that the invalid should not kill himself by adding the fuel of what he was eating to his ailment, while the guest in robuster health should not make himself ill with things not good for him and fall into discomfort from over-feeding. Suppose, among these, one of those inclined to drink is conducted out in the middle of the banquet or even at the very beginning of it; or let him remain to the very end, it all depending on the way that the president can secure that perfect order shall prevail, if possible, at the board throughout, and that the evil sights of surfeiting, tippling, and tipsiness shall be absent. It is just so, then, as when that individual is not very pleased at being torn away from all the savoury dainties and deprived of his favourite liquors, but is inclined to charge the president with want of justice and judgment, as having turned him away from the feast for envy, and not for any forethought for him; but if he were to catch a sight of those who were already beginning to misbehave themselves, from the long continuance of their drinking, in the way of vomitings and putting their heads on the table and unseemly talk, he would perhaps feel grateful to him for having removed him, before he got into such a condition, from a deep debauch. If our illustration is understood, we can easily apply the rule which it contains to the question before us. What, then, was that question? Why does God, when fathers endeavour their utmost to preserve a successor to their line, often let the son and heir be snatched away in earliest infancy ? To those who ask this, we shall reply with the illustration of the banquet; namely, that Life's board is as it were crowded with a vast abundance and variety of dainties; and it must, please, be noticed that, true to the practice of gastronomy, all its dishes are not sweetened with the honey of enjoyment, but in some cases an existence has a taste of some especially harsh mischances given to it: just as experts in the arts of catering desire how they may excite the appetites of the guests with sharp, or briny, or astringent dishes. Life, I say, is not in all its circumstances as sweet as honey; there are circumstances in it in which mere brine is the only relish, or into which an astringent, or vinegary, or sharp pungent flavour has so insinuated itself, that the rich sauce becomes very difficult to taste: the cups of Temptation, too, are filled with all sorts of beverages; some by the error of pride produce the vice of inflated vanity; others lure on those who drain them to some deed of rashness; while in other cases they excite a vomiting in which all the ill-gotten acquisitions of years are with shame surrendered. Therefore, to prevent one who has indulged in the carousals to an improper extent from lingering over so profusely furnished a table, he is early taken from the number of the banqueters, and thereby secures an escape out of those evils which unmeasured indulgence procures for gluttons. This is that achievement of a perfect Providence which I spoke of; namely, not only to heal evils that have been committed, but also to forestall them before they have been committed; and this, we suspect, is the cause of the deaths of new-born infants. He Who does all things upon a Plan withdraws the materials for evil in His love to the individual, and, to a character whose marks His Foreknowledge has read, grants no time to display by a pre-eminence in actual vice what it is when its propensity to evil gets free play." (Gregory of Nyssa. On the Untimely Death of Infants. In Migne PG 46)