our kid started to do exactly same thing when he was 19 months old. Before that he went to sleep very easily.
One evening, when we put him to bed, he stood up and started to walk around our house. I carried him back to bed many many times but after 50 mins I realized that this will not work. I still tried that few evenings.
We changed plan. Every evening we sit next to his bed. When he tried to come out from his bed we first told him that now is time to sleep and put him back to bed. After few times we then totally ingnored him but still sitting next to him. No eye contact and talking. juat sitting next to hia bed. We also tried to block his way out from bed and putting him back to bed without saying anything. Sometimes he tried to get attention biting, jumping, laughing, crying etc. Still no any contact to him after the first few minutes.
It worked.
After few weeks he realised that he needs to stay in bed. But still after 5 month when we leave the room he leaves immediately from his bed so we still sit next to his bed in a dark room, but it only lasts for 15 mins.
I hope you find a solution. Try many things, some thing will work.