One thing you could do is create your own version of the selectmany.ftl template. Copy $TOMCAT_HOME/webapps/share/WEB-INF/classes/alfresco/site-webscripts/org/alfresco/components/form/controls/selectmany.ftl into $TOMCAT_HOME/webapps/share/WEB-INF/classes/alfresco/web-extension/site-webscripts/org/alfresco/components/form/controls/selectmanywithcode.ftl and then modify as you see fit. You'll have to use share-config-custom.xml to tell Alfresco to use your custom control for the specific fields that make sense.
What you may find is that the options you want to add using code need to get some data from the repository that hasn't been handed to the control in a variable. When that happens you can drop a little client-side JavaScript into your template and make AJAX calls to the repository tier web scripts via the Share proxy. There are out-of-the-box Alfresco utilities on the client-side that wrap YUI to make this easy once you know how they work.
Sorry I don't have time to provide further detail, but maybe that gives you some ideas.