Yes you can use them inside the AMD module but keep in mind once you add an event listener on the window object it will be called everytime there is an action:ajaxify.end. If you don't want it triggered after you leave that page you need to turn it off with $(window).off('eventName', myMethod)
You know that if you edit a file of NodeBB itself it may refuse to update by
git pullbecause a merge would be needed?
So it may be that you're working with an old version of NodeBB o_O
If you are able to delete a post you have the permission to also restore it. Because of this the post doesn't get removed but only gets less opacity (within the official themes).
I just don't know in which case the post could be removed from DOM after reload, may be an inofficial theme or an old version of NodeBB (maybe because of the reason above).