Fate, I am actually interested in how you suggest establishing bedtime boundaries with a two yr old. Mine would until recently tolerate going to sleep on her own in her cot, but now one of us has to sit in her room til she drops off - often 40mins plus. If we leave she gets distressed and sometimes climbs out.
Feel free to start a thread Quodlibet. It sounds like you are doing gradual withdrawal (perhaps without realising?) but have stalled on the withdrawing bit. I could do a long post here - is that OK with everyone?
Gradual withdrawal (GW) as a sleep training method relies on trust. Your DD gets distressed when you leave the room because your presence is her source of comfort and security needed to get to sleep. As an aside to GW you could probably do with establishing some kind of super-special very precious and important snuggle thing to provide her comfort separately from you. That is an aside ready for when GW is completed though.
So your DD feels scared/worried/whatever when she is left alone and awake in her room. So she needs to trust that you will stay until she is asleep. If you sneak out before she's asleep then she might start messing around at bedtime and trying to stay awake. This is done as a means to keep you there - because you are her comfort and security. 40 mins isn't bad, I have known parents get to the stage where it takes hours. The more she trusts you will stay, the quicker she will go to sleep.
Once that trust is established (and I am assuming we are entering GW at this point - as I said you were already doing GW in establishing that trust that you will stay), then you start gradually withdrawing the amount of reassurance needed.
Say if at the moment you sit on her bed and hold her hand, each day next week sit on the floor and hold her hand. But every night stay until she is asleep. She has to trust you will stay until she is asleep.
Once she is at-ease with you sitting on the floor holding her hand (that might take a day or two or a week or two), sit on the floor and rest your hand on her back/chest instead of holding her hand. But every night stay until she is asleep. She has to trust you will stay until she is asleep.
One she is at ease with that, just sit by the bed. But every night stay until she is asleep. She has to trust you will stay until she is asleep.
Once she is at ease with that, start standing but bring back the reassuring hand on her chest. stay until asleep.
Then just standing by the bed. Stay until asleep and don't make the next change until she is at-ease with this change.
Then facing side-on to the bed. Stay until asleep and don't make the next change until she is at-ease with this change.
Then a step away from the bed. Then a bit further. Then standing by the door. But always remember to stay until asleep. Then outside the door.
Then "I'm just going to put this bathtowel in the bathroom, I'll come straight back (or whatever)". Come back and stay until asleep.
Then "I'm just putting this washing away in Mummies room, I'll come back". Come back after a minute, check she's OK, go back again, come straight back and so on.
Then a promise that you will stay upstairs while she is asleep and will keep popping your head in to check she's OK.
Then a promise you will stay upstairs until she is asleep but check on her less. Then start popping downstairs but coming back and checking she's OK.
The whole of GW sleep training method is based on trust that you will always, always stay until she is asleep. It also takes a long time if you do it in a non-distressing way. There are other sleep training methods that involve more crying and distress but work quicker.