[1.6.x] Added tests for double-pickling a QuerySet

Refs #21102.

Backpatch of 74b91b3888383fca28dea00e0e1ffb5aecec7c0f