Category query returning one fewer items than requested
If it works hard-coded, try trimming your variable:

set searchQuery = searchQuery|trim

OR, even better, build an array:

{% set categories = [] %}

{% for category in currentUser.kb__category %}
   {% set categories = categories|merge(category.id) %}
{% endfor %}


{% for category in craft.categories
  .group('knowledgeBase')
  .id(categories)
  .level(1)
  .all()
%}