your understanding is correct in terms of had sales order been cost object, this error would not have happened. But I suspect whether still configuration for sales order to be cost object is in place or not.
I would rather suggest to re look your idea of using sales order as cost object if your stock is valuated because it not recommended by sap to use sales order as cost object if stock is valuated. you may also check the below link for your reference.
make to order scenario with sale order controlling and sale order valuated stock
It would be better if you let us know the purpose of defining only sales order as cost object.
Regards
Karthik