Modifying the 3 position receiver extension would be a much easier job than what we would have to do in the old days when we wanted to make the M1014/11703 models have a functioning collapsible stock. You would need a machinist that could plot the two grooves in relation together for it to function. The collapsible stock uses the button and a steel pin to lock it in position. When you press the button, it disengages one, and allows you to rotate the stock out of the fixed steel pin. If the machining isn't done properly, the lock will disengage while firing or the stock will be very difficult to engage into the notch.
You would need to remove the receiver extension from the M4 to have the work done. You'll need a MAPP torch to do this. It's not impossible, I have done many of them.
I also have some concerns about the durability of any machining done on the receiver extension. The existing extensions are heat treated around the machine points for the collapsible stock. You can see the discoloration in the stainless steel. Any new machining won't have this. 12 gauge recoil is pretty brutal on these small pins. In our slow motion tests, the entire M4 flexes quite a bit during the recoil impulse.
Given those issues, I personally would not do this work unless you had a shop that could properly heat treat already heat treated stainless. I certainly wouldn't take it to a hobbyist or a regular hack shop. I'd look into addressing a shorter LOP by maybe finding a Limbsaver Buttpad that is thinner that could be adapted to your firearm.