It may be possible that gopis knew that Krishna took birth as Devaki's son and thus they may be speaking this way.
Another way to understand:
Vishwanath Chakravarty Thakur, a Gaudiya Vaishnava Acharya quotes from Vishnu Purana in Sarartha Darsini commentary of Srimad Bhagavatam to SB 10.21.10:
dve nāmnī nanda-bhāryāyā yaśodā devakīti ca ataḥ sakhyam abhūt tasya
devakyā śauri-jāyayā
“The wife of Nanda had two names, Yaśodā and also Devakī. Therefore it
was natural that she [the wife of Nanda] develop friendship with
Devakī, the wife of Śauri [Vasudeva].”
Thus here son of Devaki could mean son of Yasoda.
Regarding SB 10.31.4 where Gopis say Krishna as not son of Yasoda,
Vishwanath Chakravarty Thakur explains it in two different ways:
First he explains 10.31.3 :
If you want to kill us, then why did you repeatedly save us from
danger? It is not proper to save us and then kill us. You saved us
from the water of the lake filled with Kaliya’s poison. You saves us
from the vicious man eater, Aghasura the snake (vyala raksasa). You
saved us from the rain poured down by Indra (varsadi). You saved us
from Trnavarata (marut), from Indra’s thunderbolt, from the bull demon
Aristasura (vrsa), from Vyomasura (mayatmaja), from some many types of
fear (visvato). O best of men (rsabha) by killing the demons, by your
personal protection, we, who have only you as our life, were saved.
Though you protected all of vraja from the rain and other calamities,
you also protected us. Putting our faith in you as our protector, we
come to you for relieving us of the pain of being pierced by the five
arrows of cupid, otherwise we will die in the flames of separation
from you which are thousands of times more intense. Do you not fear
the sin of killing our faith?”
Then he comments on 10.31.4:
First Explanation:
“O gopis, you speak without thoroughly investigating. I, son of Nanda,
am the source of all bliss. You accuse me of the sin of killing women
and destroying faith. Therefore, I will leave this place and hide
myself so that for many births you will not see me.” Fearing such
response from Krsna, the repentant gopis began to praise him in order
to please him. “You are not the son of a cowherd woman, but rather
the soul within each jiva, the form of Vasudeva who inspires the
heart, who witnesses everything (drk). We have heard this from
Baguri and Paurnamasi. Thus we speak under inspiration from you.
Therefore do not be angry with us, but be pleased with us. We have
also heard about the cause for your appearance. Please hear that.
Because Brahma (vikhanas) prayed for you to protect the universe
(visva guptaye), you appeared in the womb of Yasoda.”
He gives an alternate explanation as follows:
“One cannot find the such suffering of the gopis among all men,
devatas, animals or birds, yet seeing our suffering you are blissful.
Therefore we conclude, you did not appear in the womb of Yasoda, who
is sensitive to a particle of suffering in others. We do not see any
of her good qualities in you.” “Then who am I?” “We think you are
the soul pervading all entities (antaryami). The antaryami, though
seeing all the sufferings of the jivas, resides there in the heart
very comfortably. We do not know the reason for your appearing in this
world, as you are so indifferent. Brahma, desiring the increase in the
creation, prayed “Stay hidden (visva guptaye), because if you revealed
yourself, all the jivas will get liberated by devotion to you, and
will leave the universe. Though you appear, remain hidden, so that
no one understands that you are the supreme Lord. What to speak
of ordinary men, who disregard you as the Lord in your human like
pastimes, even those surrendered to you will take on the role of
demons (lika Jarasandha). Thus I will be able to carry out the
creation.