The global $post value will not be valid on the init
hook. You can’t use this until after this global is set up inside of the loop. The earliest hook you may be able to use would probably bewp
https://codex.wordpress.org/Plugin_API/Action_Reference. You may also need to use https://codex.wordpress.org/Function_Reference/get_queried_object to get the post and ID since I’m pretty sure that $post still won’t have a value outside of “The Loop”