The issue was happening because array_unique keeps original keys and $processedShortcodes after refactoring contains different keys.
Application of array_intersect_key removed some processed short codes. After reseting keys in extracted shortcodes array_intersect is no longer needed.
[MAILPOET-3312]