Cool idea. Stuff like this reminds me why I like the vim ecosystem so much. At least since the introduction of terminal buffers, most people I know that use vim for serious code work have a form of "send text under cursor to shell"
Org mode is stellar at that "code in document" tangling, but I'll be honest that I loathe the M-| behavior in emacs since, unlike its vim friend, it puts the output in a separate buffer, placing the burden upon me to copy/cut it back into the source buffer
You can add a prefix arg to replace the region with the result. (Any numeric prefix works, so I usually do M-0 M-| since that's easy to type with the meta key held down, and 0 and | are close together.)