Injecting modified security plugin into OpenSearch Dashboard container

Hi,
I’m struggling to use OpenID authentication and my Dashboard enters an infinite loop of throwing:

{"type":"log","@timestamp":"2022-05-09T18:28:23Z","tags":["error","plugins","securityDashboards"],"pid":1,"message":"OpenId authentication failed: Error: Authentication Exception"}

and then being redirected back to /login and trying OpenID auth again and so on.

I’ve already read few topics on that and none have helped my solve it yet so I was thinking about modifying opensearch-security-plugin locally to add more logs to it and then injecting it into my dashboard container running in K8S cluster. Is something like that even possible?
Can I do it during runtime or would I have to rebuild an image and put my build into /plugins folder?