Create a stack driven coroutine based state machine for unity

I am working on a game where i am using a co routine based state machine in unity . I am using it because it allows me create interactive scripts .
I wanted to know how would i go about making a stack based machine , so that i can overlay game states such as when i want to pause the game to show a menu
Here is the code i am using for a state

the problem with this approach is as soon as the state machine's current state changes the loop will exit and the coroutine will exit , plus the state machine cannot start another coroutine unless the previous one finishes , how do i alter this design to make it work with as a state stack