In yoga they teach us that whatever situation we find ourselves in is a product of our own karmas. Only by exhausting our karmas can we grow as a person and move on to better (or other) things.
Here is Swami Sivananda with a quote about that:
In whatever situation God places you, it is only for your betterment. Kindly do not be discouraged. ~ Swami Sivananda
Photo by Shakti.