magento2 – Magento is not generating factory classes

I am trying to create custom table in a plugin and trying to write model classes for it. Custom database tables is successfully generated. However I am struggling to let magento auto generate model factory classes.

When bin/magento setup:di:compile command is executed only Interceptor.php file is generated and not Factory class.

Model interface

<?php
namespace CompanyOrderListenerApiData;

interface CustomOrderModelInterface {

    const ID           = 'id';
    const ORDERID      = 'orderId';
    const PROCESSED    = 'processed';

    //Getter & Setter interface definitions
}

Model class

<?php
namespace CompanyOrderListenerModel;

use CompanyOrderListenerApiDataCustomOrderModelInterface;
use MagentoFrameworkModelAbstractModel;
use MagentoFrameworkDataObjectIdentityInterface;

/**
 * Undocumented class
 */
class CustomOrderModel extends MagentoFrameworkModelAbstractModel implements CustomOrderModelInterface , IdentityInterface {
    const CACHE_TAG = 'orderlistener_custom_order_model';

    /**
     * Model cache tag for clear cache in after save and after delete
     *
     * @var string
     */
    protected $_cacheTag = self::CACHE_TAG;

    /**
     * Prefix of model events names
     *
     * @var string
     */
    protected $_eventPrefix = 'custom_order_model';

    /**
     * Initialize resource model
     *
     * @return void
     */
    protected function _construct()
    {
        $this->_init('CompanyOrderListenerModelResourceModelCustomOrderModel');
    }

    //Getters and Setters
}

Resource Model class

<?php
namespace CompanyOrderListenerModelResourceModel;

class CustomOrderModel extends MagentoFrameworkModelResourceModelDbAbstractDb {
    
    /**
     * Initialize resource model
     *
     * @return void
     */
    //custom_order is custom table and id is primary key 
    protected function _construct()
    {
        $this->_init("custom_order","id");
    }

    public function __construct(MagentoFrameworkModelResourceModelDbContext $context)
    {
        parent::__construct($context);
    }
}

Collection class

<?php
namespace CompanyOrderListenerModelResourceModelCustomOrderModel;

class Collection extends MagentoFrameworkModelResourceModelDbCollectionAbstractCollection {

    public function __construct() {
        $this->_init('CompanyOrderListenerModelCustomOrderModel',
        'CompanyOrderListenerModelResourceModelCustomOrderModel');
    }
}

Most of the guides and magento documents suggest to create these files and use auto generated factory class to persist/access data to/from custom database tables in plugin. However factory class are not auto generated with both bin/magento setup:di:compile and bin/magento setup:upgrade commands.

Does some definitions needs to be done in di.xml for this to work?