FWIW your Sales Order and Stock Inventory case is somewhat analogous to the manufucturing context BOM case developed for v11 [enhance] Item Alternative by rohitwaghchaure · Pull Request #13121 · frappe/erpnext · GitHub
Another discussion to ponder [New Feature] BOM Components Alternative