Either he has to always hold your hand (I'd say firmly) or baby reigns. I'd talk to my toddler and say because you keep running away we need to do this instead. When you can walk nicely we can try to do it without hand/reigns. I'm a pretty gentle parent but things like this that are risky stern and serious mummy needs to come out
I instilled into my daughter that she must hold my hand when it's busy/dangerous, otherwise she has to go in the pushchair/shopping trolley etc She still does occasionally rebel though
My son is literally the same. He’s been doing it since he could walk and now he’s 3 so I needed up having to get a toddler walking reins 🤷🏽♀️. I need like the idea of it on a kid but that was the only choice lol .