Maxim,
Thanks for the clarification of the abstraction on protocol extensions within the MAIL module.
For my specific purposes, I am seeking to be able to hide special folders (always labeled the same) that are used for administrative purposes in mailboxes. I don't believe that this requires statefulness from connection to connection but rather the ability to watch for specific IMAP commands requests (as is already the case) and modify the behavior and/or intercept the results and manipulate them slightly before returning the modified upstream response.
Regarding modifying NGINX code, I appreciate the concept of encapsulating the changes needed as much as possible. As I provided in my example (which originally contained no COPY command) I believe the desired construct exists for what I am wanting to do but I just don't have the skills to effectively complete the task. So, my hope is to see if there are others that would be served by a more generalized abstraction model with the MAIL module and/or are there developers out there willing to help with this project.