Fret not, as there is apparently a simple solution, which can save your precious pen detection feature. That is, unless you've already managed to take the stylus out, in which case you're likely past the point of no return.
Shown in the video below, the fix uses a piece of paper inserted parallel to the stuck S Pen, wraps around it and shields the detection lever as you're pulling the stylus out. Now, while that will preserve the tiny plastic detection lever, its unclear what you need to do of the S Pen's head gets properly jammed in the other lever deeper down, which is meant to keep the stylus firmly inside. Perhaps, another piece of paper on the other side might help.