The 18-minute rule is one of a few heuristics offered by the Talmud for determining whether a dough has become chametz. These are summarized by the Rambam in Hilchot Chametz Umatza 5:13:
כל זמן שאדם עוסק בבצק אפילו כל היום כולו אינו בא לידי חמוץ. ואם הגביה ידו והניחו ושהה הבצק עד שהגיע להשמיע הקול בזמן שאדם מכה בידו עליו כבר החמיץ וישרף מיד. ואם אין קולו נשמע אם שהה כדי שיהלך אדם מיל כבר החמיץ וישרף מיד. וכן אם הכסיפו פניו כאדם שעמדו שערותיו הרי זה אסור לאוכלו ואין חייבין עליו כרת:
As long as a person is busy with the dough, even for the entire day, it will not become chametz. If he lifts up his hand and allows the dough to rest so that [it rises to the extent that] a noise will resound when a person claps it with his hand, it has already become chametz and must be burned immediately. If a noise does not resound and the dough has lain at rest for the time it takes a man to walk a mil, it has become chametz and must be burned immediately.
Similarly, if its surface has become wrinkled [to the extent that it resembles] a person whose hair stands [on end in fright] - behold, it is forbidden to eat from it, but one is not liable for כרת [for eating it].
The primary heuristics are physical observations: hearing a noise when the dough is clasped or seeing a change in the dough's surface. Secondarily, there is a time heuristic, which comes from the Mishna and Gemara on Pesachim 46a:
מתני׳ בצק החרש אם יש כיוצא בו שהחמיץ הרי זה אסור:
גמ׳ אם אין שם כיוצא בו מהו אמר רבי אבהו אמר רבי שמעון בן לקיש כדי שילך אדם ממגדל נוניא לטבריא מיל
Mishna: Deaf dough, if there is dough similar to it which became leavened, is prohibited.
Gemara: If there is no dough similar to it, what is the halakha? Rabbi Abbahu said that Rabbi Shimon ben Lakish said: the time it takes a person to walk the distance from Migdal Nunaya to Tiberias, which is a mil.
So, the definition of the 18-minute limit is something like "the shortest duration in which anyone, to the Sages' knowledge, had ever observed dough to take from being left alone until it was showing the first signs of leaven." To make sure that we're not accidentally consuming any leaven at all on Passover, we don't use dough that sat for this duration, even if we don't observe signs of leavening directly.
Now, note the context in which the Rambam lists these heuristics. He's talking about (and interpreting the Talmud to be talking about) fully-formed dough that's been mixed and worked for an arbitrary amount of time, then left alone. Given these conditions, the dough could have had ample time and exposure to allow airborne yeast to enter and get incorporated. What it hasn't had the opportunity to do, thanks to being worked the whole time, is build up any appreciable amount of internal gas, which would cause rising, hollow sounds, and surface changes.
It seems, therefore, that the change that makes the dough forbidden is specifically the buildup of gas, not the incorporation of yeast or any chemical change. The 18 minutes is the minimum time it could take for gas to build up, and the minimum would naturally be when a dough has already incorporated a healthy dose of environmental yeast.
That explains the physical origins of the 18-minute limit, consistent with the process you describe of first airborne yeast being incorporated, then rising happening.
The question remains: if this limit is intended to apply only to dough that's already mixed and left alone, why do we apply it to the time from flour first meeting water until the matza is fully baked, having been worked continuously the whole time before it gets into the oven? I dealt with that question previously here. The bottom line1 is that latter-day posekim, taking minority opinions among the rishonim into account, rule that we should be extra-strict with respect to Passover by applying the 18-minute limit to the entire time of preparing the dough, even if it's not left alone. I couldn't find any source for the common practice of including the baking time into this limit as well, but it's not difficult to imagine that this is the result of yet another layer of using the very strictest possible interpretation of a rule.
1. See R' Eliezer Melamed, Peninei Halachah, Pesaĥ 2:4 "The Definition of Leavening Dough" - Footnote 3.