Is there a known first reference to art being ordered and paid for ahead of time? Or is it just assumed that it's been going on for as long as art-as-a-trade has been a thing?
As long as there has been portraiture, there has been commissioned art. While not directly related to your question, Michael Baxandall's Painting and Experience provides an insightful account regarding the relationship between the artist and the patron during the fifteenth century in its first chapter. Pretty cheap on amazon (usually only a few pounds or so) and is, in my opinion, essential to understanding this relationship.