Avoid pickle max recursion while serializing chain

Added manual test for recursion.
Manual test executes against the testing database
and does not get run on regular runs.

Bug: 67823
Change-Id: I17b5aac9b90c49ea0f75d241ceb00c5007ed6ea9