Not sure if I understand the scenario completely, but you could use Microsoft.Web.Administration namespace to create rewrite rules programmatically. See this blog post for an example.
If this does not help - could you provide more details on why it is necessary to generate rewrite rules at application start up as opposed to just configuring them in web.config?