Why is ‘register_activation_hook’ undefined?

WP plugins are meant to be loaded in context of WordPress core load. They won’t work as vanilla PHP, unless you purposely abstract some parts completely away from WordPress.

The typical practice is to have actual working WP installation locally and develop in its context.