Yes, If we pay attention to the Puranas, we can understand that all three guna-avatars (Brahma, Vishnu, Shiva) are transcendental to the modes of nature in which they control. Yet, they appear in the Lila (pastime) as if they are under the influence of those modes.
If we are intelligent when reading the Puranas, right away we can understand, that there is a higher purpose behind the seemingly conditioned nature of the guna-avatars.
Just as a sage's curse ultimately becomes a blessing in due course of time, so Shiva's performing penance after cutting off the head of Brahma, is ultimately meant to provide an opportunity for him show conditioned soul how to live as an ascetic and the follow the path of purification from great sins such as 'brahma-hatya' killing a Brahmana.
The difference between mortals (jivas) and Bhagavan (God) is that our illusion leads to suffering, their illusion is pastime that leads to an event that will ultimately create a benefit for humanity.
Also you should know there is different kinds of maya.
For conditioned souls, we can be covered by maha maya.
For the Gods they have a different maya called yoga-maya. By this yoga maya potency enacts to make Bhagavan feel human. Such as Krishna crying when the demon Shalva created an illusion of killing Vasudev in the battle at Dvaraka.
SASTRIC EVIDENCE
Shrimad Bhagavatam (10.3.20-21):
“O Lord, You appear in the pure (suklam) form of Vishnu, which is free from all contact of the material modes of nature, and You also appear in a reddish (Brahma) and blackish (Siva) form for material creation and annihilation.”
We many note here that as Lord Vishnu remains untouched by the three modes of material nature, so Brahma and Siva also remain untouched by the three modes of material nature.
That Vishnu, Brahma and Siva are above the three modes of material nature is the conclusion of Shrila Sukadeva Gosvami, who said:
Shrimad Bhagavatam (10.88.3):
“Siva appears to display the qualities of all three modes of nature, although He is actually free from their influence. He is full of all potencies, and His real transcendental nature remains hidden from the perception of ordinary men.”
Shrimad Bhagavatam (10.3.50):
"The Supreme Lord remains always free from the modes of nature, even though He may sometimes appear to be under their influence. "
This verse clearly explains that although the Lord may sometimes appear to be acting under the influence of the modes of passion and goodness, this is appearance only, and the Lord remains always free from the influence of the modes of nature.