As far as I recall, this code was trying to solve a problem where something external would call `getApplication()` before setProxy(), causing a reference to `this` to be leaked. But I expect that's only possible now if someone calls getApplication() in the entity's constructor.

I see you've fixed that below in `getApplication()`, so I'm happy for us to delete this code, rather than commenting it out.

If we do want to catch someone calling `getApplication()` or `setApplication` too early, maybe we