Odd, I took a look at the current 2.x HEAD and the following worked fine in a controller:

```php
function index() {
  $this->getEventManager()->attach(function () {
    echo 'Before render callback';
  }, 'View.beforeRender');
  // Rest of controller action.
}
```