You could use By-Products (Manufacturing -> Configuration -> Settings -> Operations section -> By-Products) or reverse your manufacturing by using Unbuild Orders (Manufacturing -> Operations -> Unbuild Orders)
See also https://www.odoo.com/documentation/18.0/applications/inventory_and_mrp/manufacturing/workflows/byproducts.html and https://www.odoo.com/documentation/18.0/applications/inventory_and_mrp/manufacturing/workflows/unbuild_orders.html