I tried to fix the issue, but my knowledge of Jenkins internals is insufficient. Let's me just describe where I stopped.
One approach is to introduce a dependency on the Matrix plugin. email-ext-plugins is an example of such code. It can select whether the post-build action happens in child builds, in the top-level build or in both. But I would rather avoid adding a dependency.
I believe that StashPostBuildComment.perform() is not the best place to publish the configuration of StashPostBuildComment, as it happens in a child build. But I've noticed getRootProject() and getRootBuild(), I'll see if they would help.
A cleaner approach would be to examine the project for an object of the given class, just like it's done for the trigger. StashBuild.onCompleted() calls StashBuildTrigger.getTrigger(build.getProject()), which is implemented using project's getTrigger(). That would make it possible to read the StashPostBuildComment configuration from the project. But I don't see such method for post-build actions.
Another approach would be to make StashPostBuildComment listen to some event that happens for the top-level build and publish its configuration with addAction to that build.