See the picture?
Today I spend a lot of time working on a NSApplicationDelegateMBS class. This class gives you more than 20 application related events including a dockmenu event. There you can build your menu to be displayed in the dock. The event fires everytime the menu is about to be shown, so you can add menu items there dynamically.
As you see we can have all the typical menu features like separators, checkmarks or submenus.
This will be available with 11.2pr5 plugins later tonight (or tomorrow). For Carbon applications, you can use our existing CarbonApplicationEventsMBS class.