Not sure how… but here’s an idea - what do you think about it:
In all(?) core buttons, insert an action param and give it an argument that the user can define. For example:
title: $:/core/ui/Buttons/close
text:
<$button actions="{{$:/core/ui/Buttons/close-actions}}">
$:/core/ui/Buttons/close-actions is empty (non-existing) by default but users can then define arbitrary strings of actions.
With that said, I did request this but there was no interest or feedback.