This is rather horrible architecture. It makes code maintenance unnecessarily hard because you have to be very careful not to build any endless loops (possibly similar to https://github.com/phpseclib/phpseclib/pull/317#issuecomment-40491613, which is at least unnecessarily hard to debug).