Remove action working on functions.php but not in a plugin. Why?

The include of custom code via theme is different from the including via plugin.
It is important, that you add a hook to include your custom source inside the plugin, like after_setup_theme, maybe with a low priority, after the default theme init his code.