I am looking for the same functionality. What you have found is being used in module "Sale Purchase" (sale_purchase). This is its description:
Allows the outsourcing of services. This module allows one to sell services provided by external providers and will automatically generate purchase orders directed to the service seller.
This module adds "Purchase Automatically" option to Products of type Service. When it is checked and there is Vendor set for it, upon putting it into Sale Order Line and that Sale Order is confirmed, it will automatically create/update Purchase Order and create Purchase Order Line and will link those Lines together and origin attribute (Source documents) is updated. There is also a smart button (which is currently disabled in 13.0 - I created PR to enable it again: https://github.com/odoo/odoo/pull/51874) which allows you to open linked POs from SO.
However in case of MTO (and checking Buy option) this goes through "Purchase Stock" (purchase_stock) module where PO and PO Lines are created, origin attribute (Source documents) is updated but the records are not linked together. That's why these attributes are always empty.
I am looking for a way to do this but in sale_purchase the PO/POLs are created directly from SO/SOLs so there is no problem linking them. However in purchase_stock the context is different - the PO/POLs are created somewhere in context of StockRule in the method _run_buy(self, procurements) where the originating SO/SOLs are not easily accessible (at least for me). But I need this so will look for an option...