Somewhat more specifically, you want to know when the statement handle is no longer being used so that it can clean itself up (and perhaps warn that you left it in an unfinished state, probably indicating a bug).
The described bug that is prevented by removing the quoting sounds exactly like somebody has a bug in their ref count management in their XS code. It sounds like somebody has marked a variable as "mortal" and so the subsequent method call decrements the variable's ref count, destroying it even though an attempt is then made to use it. The destruction doesn't happen if the returned blessed reference is saved into a named variable.
Have fun finding the ref counting bug in the XS code. It is rarely even close to an easy task. On the other hand, introducing such bugs is extremely easy in XS code and is probably one of the major contributors to the rather frequent problems I see with "weird bugs" that just "go away" when some XS module stops being used (even though the XS module doesn't even seem related to the "weird bug").
I wish more XS authors learned to only manipulate Perl data structures from Perl code, strictly minimizing their XS code. Or, usually better, just skip the XS code altogether.