That is in fact how the first HKM4's (HK416's) were developed. HK took US Govt "loaner" M4's and modifed them with an HK-made CHF barrel, op rod gas system and bolt group. The same was done with a Dutch-built original AR10 for the first shooting HK417 prototype. While it can be done I would not "try it at home". One of the drop in kits mentioned herein might be a better choice if you want to convert a DI gun to op rod.
G3Kurz