Run a code only on theme activation only during first activation

What about using WordPress Options API to store a flag whether it is the first switch or not:
https://codex.wordpress.org/Options_API

<?php
  add_action('after_switch_theme', 'setup_theme_options');

  function setup_theme_options () {
    if(get_option('first_theme_activation') === false){
      // Set a flag if the theme activation happened
      add_option('first_theme_activation', true, '', false);

      // stuff here only runs once, when the theme is activated for the 1st time
    }
  }

Going back to Jacob Peattie’s note, register_activation_hook() is for plugin use and not for theme switching. And unsetting content could become tricky, because you don’t know what is there.

Either way, I hope this answers helps!