Hello,
this is my situation:
Joomla 4.0.4 with standard Cassiopeia template
a Categories tree in a module published in home page (module assignement on all pages)
the Tree doesn't work because I have a lot of "jQuery is not defined" errors.
I checked the source of the html page and there is not the loading of the jQuery library.
I do this test:
I added an Edocman Categories module on home page (module assignement on all pages).
If I click on a category to show the documents, the "new" opened page shows correctly the tree without jQuery errors.
In this case, the html source has the scripts to load the library.