I have seen the same, and have even aded this in a comment in the above code. The upgrade should just log this and then continue.
I did not raise more alarms when writing this code, because I have seen it before. Ah, I have found an earlier report by myself from July last year. But in November I could no longer reproduce it:
If I interpret this report correctly, in some Plone 5.2 version there was a problem where a clear and rebuild of the catalog had the side effect of adding a brain for the portal_catalog itself. This should no longer happen, but on existing sites you could still have this problem.
Should be fine to manually go to the portal_catalog and remove this brain. Maybe add an upgrade step in plone.app.upgrade.
Wait a sec, my the patch is relevant only for the clearFindAndRebuild method.
Most probably the same check (obj != self, where self is the portal_catalog) should be also added in some other place (e.g. the indexObject or the reindexObject methods of the catalog tool).