Intercept all requests before a Controller Action is executed
You're correct about both beforeAction() and onBeginRequest().

However, you could put an init() method in your main plugin class file and this will execute on every request as long as the plugin is installed and enabled.

public function init()
{
    // Whatever code you were going to put in onBeginRequest can go here.
    parent::init();
}