I'm on my pod so can't see how old your boy is.
We have a strong routine, and it has been going so long they pre-empt everything now, but when dd was little we basically left the toddler gate on her door. Once the story had been read and the bedtime songs had been sung, the light went out and we would leave. Often she would play in the darkened room for a little while.
Then we would come in before we went to bed and put her into hers. No big deal.
Hth
That is what I do with DD1, minus putting into our bed as her sister is already there. I don't care what she does as long as she doesn't destroy anything. But it's go to bed, I read her two stories, goodnight hug and kiss and then I leave. When she falls asleep is up to her, but she has to stay in her room.