Build form elements in buildForm() only, not in ajax callback. The ajax callback is only for preparing the ajax response. When the ajax callback is called, buildForm() has already run with the updated $form.
Your ajax response is empty. You didn't add any ajax command to it. See ajax examples how you can do this.
But in your case you don't need any code in ajax callback. It would be enough to simply return the changed part of $form in a div container.
For this put an empty container in buildForm() and move the select form element from the ajax callback to buildForm() and put it in the container, if the condition in $form_state is met:
$form['ajax_wrapper'] = [
'#type' => 'container',
'#attributes' => ['id' => 'ajax-wrapper'],
];
if ($form_state->getValue('level1') != false) {
$form['ajax_wrapper']['level2'] = array(
'#type' => 'select',
'#description' => 'Please select level two term',
//'#options' => $terms,
'#attributes' => array(
'class' => array(
'mycategory'
),
),
);
And the ajax callback:
public function ajaxCallback(array &$form, FormStateInterface $form_state) {
return $form['ajax_wrapper'];
change #ajax to:
'#ajax' => [
'callback' => '::ajaxCallback',
'wrapper' => 'ajax-wrapper',
],