That is the Lila. The whole creation itself is a cosmic play. The struggle is mandatory because if everything had to be perfect then the creation itself would not have any purpose. Perfection is the absolute oneness of Shiva and Shakti, the eternal reality. Shiva and Shakti in absolute reality is one and only Ultimate Force. Non duality (Advaita) is that inseparable state which is perfect in its own.
The struggle or hardship faced by them in their avatar lila is the actual play, it’s like a movie. The One absolute reality manifests into two (or multiple forms considering all the deities in Sanatan Dharma), then they meet each other, marry, then separate due to circumstances (essential part of lila) and then reunite.
It is because Shakti or Parvati in her most transcendental form is described as Lalita Tripurasundari. This name itself tells everything, “Lalita” means playful. So she is that playful side of the detached (Vairagi) Shiva himself. When it is a play, there need to be perfect or smooth events.. struggles, separation and reunion would be an integral part of lila.
Shiva originally is dispassionate and in his own non-dual state of eternal bliss. But Shakti, his own projection causes this entire play. Hence the static consciousness Shiva has to engage himself in the play with his own dynamic power. That is the actual purpose of all the events, hardships, love story and other lilas of Shiva and Shakti. These are the two sides of the same coin and present in all the beings, Shiva refers to the soul, the existence or the inner self which is the observer and Shakti is the executive power, the divine energy because of which the body of a person is able to do the action. Together as one inseparable force, it is the complete reality.
Jai Shiv Shakti 🙏