after_setup_theme
fires before init
, so in this case the code is trying to insert a term into your taxonomy before WordPress is aware that your taxonomy exists!
Generally, I feel like init
is a better location for both pieces of functionality unless you have a reason to do otherwise. But however you resolve it, if you keep the two in separate functions and use the same action, you might want to give the hook which is used to insert terms a larger priority number just for peace of mind, such that it will most definitively always execute after the taxonomy is registered.