Hello,
if you create the cart and then log in the customer, the cart should be assigend to the customer, if you use the same context. Did you already tried this? The customer routes could be found here: \Shopware\Core\Checkout\Customer\SalesChannel\SalesChannelCustomerController
Best regards from Schöppingen
Michael Telgmann