Hey,
You can try to register a custom provider to PopupMenu. Note that PopupMenu class is under diagram-js library which is also a part of bmpn.io toolkits.
popupMenu.registerProvier
API can be used to register a provider.
Have a look at ReplaceMenuProvider
class under bpmn-js, which is a provider itself. You’ll then have an idea about how to implement your own provider.