Yes, it would keep it from rolling off of a kickstand and wouldn't have to be parked on a flat surface. It might be possible to just drill a small hole in the brake lever and then insert a cotter pin.
I think I remember seeing something like these on that new cargo bike rad was releasing. It seemed like it was like a rope/bungee cord that just tied the brake lever down, simple but it does its job.
I use a velcro loop for this purpose during maintenance and adjustments. But it's not something I really use when I'm out and about. I find it's quicker to re-position my bike so that it's stable rather than to fiddle around with the loop; especially when wearing gloves.
I use several of these brake bands that were included with collapsible kickstands that I purchased online. You could easily make one from shock cord and trapezoid tabs. The bands are taut enough that they can remain on the bars without having to remove them.