Not me but I bet I could using one of the cheap brake lights sold by overseas vendors for less than a dollar as a start.
https://www.ebay.com/itm/Bike-Brake-Light-Mount-Tail-Rear-Bicycle-Cycling-LED-Safety-Warning-Lamp-useful/253071640656?hash=item3aec3ec850:g:v4IAAOSwr7tZfpRs It's a momentary contact switch that engages when you pull on the brake handle. Disassemble it and use it as a switch for a larger light. Not much lost if it isn't successful or you wreck it.
The idea of brake lights has been discussed here and on other bike sites. Brake lights on a vehicle work because they are bright and have a large lighted area. Over the years they have gotten bigger. Look at a vintage vehicle and you will often see a round brake light a couple inches in diameter. Not so today. In contrast, bike tail lights which could be modded to be a brake light are only a few square inches and mostly 100 lumens or less. It's been a lumen war lately among bike light manufacturers so brighter ones are showing up but do you really want to mess with an expensive tail light? Maybe the inexpensive Chinese ones yes.