Here: https://github.com/joomla/joomla-cms/blob/staging/libraries/cms/plugin/plugin.php#L108
It's some "magic" done by JPlugin. The same applies to `$app`.