Allow ClassMetadata to invoke lifecycle callbacks on proxies

Fixes #763.