Zend certified PHP/Magento developer

Magento 2: Quote is null in collect() totals function immediately after a successful order has been placed?

So I am overriding collect() using etc/sales.xml

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Sales:etc/sales.xsd">
    <section name="quote">
        <group name="totals">
            <item name="somediscount" instance="VendorModuleModelTotalQuoteTotalsWithBonusProducts" sort_order="480"/>
        </group>
    </section>
</config>

Having placed an order, from the success page, I immediately go to a category page and add a product to the cart, effectively starting a new order/cart. To my surprise, in my collect() function the quote is null.

    /**
     * @param MagentoQuoteModelQuote $quote
     * @param MagentoQuoteApiDataShippingAssignmentInterface $shippingAssignment
     * @param MagentoQuoteModelQuoteAddressTotal $total
     * @return $this|bool
     */
    public function collect(
        MagentoQuoteModelQuote $quote, 
        MagentoQuoteApiDataShippingAssignmentInterface $shippingAssignment,
        MagentoQuoteModelQuoteAddressTotal $total
    )
    {       
        $address = $shippingAssignment->getShipping()->getAddress();
        if($address->getAddressType() != 'shipping'){
            return $this;
        }
        
        if(!$this->customerSession->isLoggedIn())
        {
            $this->logger->critical("TotalsWithBonusProducts: Customer must be logged in for getBonus");
            return $this;
        }
            
        if($quote->isVirtual())
        {
            $this->logger->info("TotalsWithBonusProducts: quote is virtual, skipping bonus api");
            return $this;
        }

        $quoteId = $quote->getId();
        $this->logger->info(basename(__FILE__) . ":" . __FUNCTION__ . " - quote_id before ::collect() - " . $quoteId);
        $this->logger->info(basename(__FILE__) . ':' . __FUNCTION__ . " quoteData: ", $quote->getData());

        parent::collect($quote, $shippingAssignment, $total);
        
        $quoteId = $quote->getId();
        if (!isset($quoteId)) {
            $this->logger->critical(basename(__FILE__) . ":" . __FUNCTION__ . " - quote_id is NULL !!!! aborting", $quote->getData());
            $this->logger->info(basename(__FILE__) . ":" . __FUNCTION__ . " - quote_id from checkoutSession" . $this->_checkoutSession->getQuote()->getId());
            return $this;
        }

If I add a second product to the cart, the quote is not null and I can get the quote_id. I don’t understand what is going. I’ve tried everything under the sun but without any success.

The customer is logged in, so why would the quote be null in the collect() function, at the start of a new order, for the 1st product added to the cart? It makes no sense.

Does anyone have any ideas?

Thanks,
Michael.