Solution 1:
My guess is that because you’re calling this function both on the init hook and on admin views, the admin_notices hook gets triggered during plugin activation. This causes your plugin to output a notice while it’s being activated, which is unexpected—init isn’t supposed to echo anything.
I also don’t see a need for this function to run on init. Instead, you could call it on admin_notices and adjust the logic so that the notice only displays once the plugin has been activated.
Additionally, your current code doesn’t check whether the other plugin is active or even installed, so users would see the message regardless of whether that plugin is present.
There’s already a well-established library for requiring and recommending plugins in WordPress called TGM Plugin Activation. I strongly suggest using that instead of writing your own custom logic.