SRE here, most of time when that happens, it's people leaving .env in git where it's not ignored and build process just does COPY * * to runtime environment.
EDIT: Or it's just small time developers who don't care about security and ship whatever works.