I ran into this problem when I successfully created my first Magento 2 module. The categories were just nowhere to be found.

The problem turned out to be that my layout XML file did not have the layout tag included in it. For the most part this XML was copied and adapted from the tutorial I used.

The layout XML file I had looked like the following:

<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../lib/internal/Magento/Framework/View/Layout/etc/page_configuration.xsd">
    <body>
        <referenceContainer name="content">
            <block class="Ocaff\CustomPage\Block\CustomPage" name="custompage.index" template="custompage.phtml" />
        </referenceContainer>
    </body>
</page>

As it turned out, the tutorial did not include the configuration for the root layout to use for this page. Magento 1 users will remember these as 1column, 2columns-left, etc. These same layouts still exist, you just have to put them in a little differently in Magento 1.

In the end, it looks like this:

<page layout="1column" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../lib/internal/Magento/Framework/View/Layout/etc/page_configuration.xsd">
    <body>
        <referenceContainer name="content">
            <block class="Ocaff\CustomPage\Block\CustomPage" name="custompage.index" template="custompage.phtml" />
        </referenceContainer>
    </body>
</page>

Notice the layout declaration in the page tag.

While we’re discussing layouts, the location of these layouts in Magento 2 is: /app/code/Magento/Theme/view/frontend/page_layout/1column.xml

I am pretty sure that you do NOT want to be modifying the files in this location as you should assume that the Magento vendor directory is the same as your “core” code pool from Magento 1. Once I figure out how you should override these files, I will update this post.