One of the first - best reasons for class file rewriting is for high performance dynamic  method binding and invocation.  The pico servlets idea was applied in a couple cases to dynamically bind static functions of known call signatures for server side programming.

A more interesting idea for class file rewriting is more recent, "replacing" MONITOR ENTER and EXIT instructions with system / framework function calls for distributed state management.