Now that's a cool idea! And definitely possible, but we do not have something like that planned. I might turn it into a hobby project but I give no guarantees :-)
The other way around is to insert a Java Action in a microflow that has all the context (Variables, Iterators etc). Would be more in line the the (imho good) principle of Mendix not to generate code but to interpret models.
You can already call a Java action anywhere inside a microflow and pass all the variables you need to it. So you can model most of your logic using a microflow and then call a Java action for a small part.