As far as I know, a toggle option is not implemented nor can it be improvised via macro programming.
However, I use the D-button on the throttle just like your second option. Holding down means breaking until you release it. Just like the original K-key on the keyboard.
But there was nothing complicated about achieving this behaviour. In fact I used the easiest way there is. Just choose the button you're going to use, press K and then click the green check-button. That's all and it works just fine.
But perhaps I misunderstood some of your description and it's not exactly what you're looking for.
PS: Advanced commands (or whatever it is called in the English version of the software) are closer to what you were looking for in the firstplace. Macro just records your keypresses while advanced commands give the possibility to change the behaviour on press and release. But the simple version works as well.
Another idea: If you're not using the precision slider, you could use banding to make it something like a toggle switch.
For example, if you divide the axis in two areas with one being the K keypress and the other empty, moving the slider to the area would toggle the brake until you move the slider back.
I used this behavior for airbrake out and in (with 3 areas, middle = empty, forward = airbrake in, back = airbrake out).
But be careful with shift or ctrl combinations. Because as long as that combination is held down, shift or ctrl will be applied to all other keystrokes as well. Almost crashed the plane because of this.
So remember to put the slider back to normal to avoid that.