This piece of code looks very similar to the code I’ve exposed above – “Function.js checks for new tags added and modifies them to delay loading for iframes, apps, tracking pixels, shopify pay codes”
This is why your pagespeed has dropped – all these JS codes are now running much earlier then before and delay page rendering.
It’s probably not malicious by itself, but hard to tell without further investigation.