How can I pin edges in sculpt mode?
Like lemon already suggested, the masking tools are your best choice. Yes, you will get the flat faces as well, just as with hiding them, but afterwards you can - with the mask still active - smooth the borders using the smooth brush.

on the bottom left of the screenshot you can see the Hide/Mask menu. Choose one that fits you best. My example is so simple I was able to use box select for this. Basically mask everything except the boundary.



after that, you'll see that the inner part turned black (that means it is masked), and the outer part is grey (editable).



We need the opposite, so we invert the mask with Ctrl + I



Now we can sculpt as we like, ignoring the fact that we get heavily distorted faces on the outside.



With the smooth brush, this can be fixed easily and with a lot of control!