That's not exactly fair. The entire point of this exercise is to move away from C code, by implementing it in a memory safe language (Go).
Since PAM uses shared-libraries to operate, that's fundamentally incompatible here since Go is statically compiled (unless you use some CGO like in https://github.com/msteinert/pam) so implementing auth via Caddy's module system is the way to go for this project.