If this question is answered with the knowledge of God found in Scripture the answer is no, the woman was not an afterthought. An all-knowing God does not have an afterthought during His work of creation (or any other time). Genesis 1 makes clear creating man and woman was a planned action.
Nevertheless, it is commonly accepted among contemporary scholars that Moses was not the divinely inspired author of Genesis and the texts must be approached from the perspective of multiple authors whose knowledge and understanding of God differed from one another. Therefore, a modern reader cannot presume an ancient author and reader were equally knowledgeable.
So let's examine the text from that point of view.
According to modern scholars the documentary hypothesis explains the differences between the creation accounts in Genesis 1-2:4a and Genesis 2:4b-24. Genesis 1 is attributed to one source (Priestly) and was written much later than the Genesis 2 account, attributed to a different source (Yahwist) and was written about 950 BCE. [Two Creation Accounts]
The earliest account is in Genesis 2. So the OP's question should be restated: "Does this author portray the creation of the woman was an 'afterthought.'” When the LORD God failed to find a suitable companion from among the animals, He tried something new, a woman and finally found success. According to scholars such as Leon Kass (see Dick Harfield's answer), this demonstrates the woman was an afterthought.
Let's consider what the author has described to judge whether it is an afterthought or a purposeful act.
So Adam gave names to all cattle, to the birds of the air, and to every beast of the field. But for Adam there was not found a helper comparable to him. (Genesis 2:20 NKJV)
By bringing the woman last, the LORD God proved, the woman was the only suitable companion. She was the only one, among every other one. She was not only suitable, all the others were unsuitable. There is a discussion on the meaning and significance of the phrase “they shall be one flesh.” In Genesis 2:24, how do a husband and wife “become one flesh”? There the point is made that the author has described a situation of unity, and a commitment to companionship and other positive aspects. This is possible because the woman is “the only” one suitable for the man: a fact that would never have been brought to light had the LORD God presented the woman at the start.
Moreover, this was accomplished through the direct participation of the man. This author has portrayed Adam as an informed decision maker, naming every animal the LORD God brought. The author's sequence of events is inherent and integral to the main point his account: Genesis 2:24.
There is an additional relevance to the author's sequence:
Then the man said, “The woman whom You gave to be with me, she gave me of the tree, and I ate.” (Genesis 3:12 NKJV)
Very carefully the author has both described and undermined Adam’s defense. First the man rejected every other option the LORD God presented. Then the man demonstrated acceptance and ownership by naming her:
And Adam said: “This is now bone of my bones
And flesh of my flesh;
She shall be called Woman,
Because she was taken out of Man.” (Genesis 2:23 NKJV)
The two were one flesh. There was no afterthought. What is described are the actions of the LORD God who clearly understood what was going to happen and how Adam would attempt his defense.
Consider the situation had the LORD God made the woman first. There would be no need for the LORD God to resort to the animals since He was successful on His first attempt.
Had the LORD God started with what was going to work first, the man’s defense would have a much greater legal standing. He could claim that had the LORD God brought a dog instead of the woman, he would have had his best friend and never have been subject to eating the fruit. However, according to the Yahwist source that defense fails since Adam first rejected the dog and every other animal and then accepted the woman who in fact, was the only one suitable.
Both are created conditions; both are purposeful. The man had been created so that only the woman would be suitable and immediately validates what follows:
Therefore a man shall leave his father and mother and be joined to his wife, and they shall become one flesh. (Genesis 2:24 NKJV)
However, according to modern scholars that is just the beginning and the next chapter is found in Genesis 1, the one written by the Priestly source long after the first more primitive account.
The Priestly source immediately puts to rest any idea that the woman was an afterthought:
Then God said, “Let Us make man (אָדָ֛ם) in Our image, according to Our likeness; let them have dominion over the fish of the sea, over the birds of the air, and over the cattle, over all the earth and over every creeping thing that creeps on the earth.” So God created man (הָֽאָדָם֙) in His own image; in the image of God He created him; male and female He created them. (Genesis 1:26-27 NKJV)
Modern scholars fail to acknowledge the Priestly source actually continues the story of Adam by incorrectly translating "Adam" as "man." Apparently, this is done because the Priestly source inexplicably states הָֽאָדָם֙ (literally “the Adam”) was created in the image of God He created him; male and female. In other words, the Priestly source not only states the woman was not an afterthought, she was essentially equally part of “the Adam.”
This author continues having God (Elohim) bless them both; gives dominion to both; food to both. According to this author the two have become more than one flesh: except for the anatomical differences they are identical. It is no longer two become one; the "one" has a dual nature which now defines one in a manner that is whole and as such different (from Genesis 2:24). The Adam who was alone in need of a companion in the Garden has become The Adam who can never be alone since both his and her essential nature are literally intertwined.
So what can modern readers conclude when these two accounts are finally redacted and combined?
According to the Yahwist source, creation of Adam begins:
And the LORD God formed man of the dust of the ground, and breathed into his nostrils the breath of life; and man became a living being. (Genesis 2:7 NKJV)
According to the Priestly source Adam’s dual nature was reflective of being made in the image of God:

I would conclude the two accounts have been purposely written to prove man has a triune nature, which is the image of God.