hook_page_attachments() not called from mytheme.theme file
It appears that this function is only callable from a module, as it is listed in  Adding stylesheets (CSS) and JavaScript (JS) to a Drupal 8 module but not listed as a valid method in Adding stylesheets (CSS) and JavaScript (JS) to a Drupal 8 theme.

It should be noted that the related function hook_page_attachments_alter() can be called from the theme layer (i.e. can be called from mytheme.theme file).

function mytheme_page_attachments_alter(&amp;$page) {
  $page['#attached']['library'][] = 'mytheme/general-js';
}


Alternatively one can attach libraries to a page from within hook_preprocess_page()

function mytheme_preprocess_page(&amp;$variables) {
  $variables['#attached']['library'][] = 'mytheme/cuddly-slider';
}


The advantage of these two methods is that it enables one to utilize logic/code to determine whether or not to attach a library to a page.