After reading your issue in diagonal, it seems it's to do with
electric-quote-mode and electric-pair-mode.  I wrote the latter
mostly, but I didn't write the former, which I think is only for
UTF-8 quotes.  I personally turn it off.  I don't think it respects
the auto-balancing ideas I put into electric-pair-mode.

(if that's even what you're asking about, I still haven't read and
processed all your text).

João