If you navigate to https://192.168.1.200:9999 in your browser, as far as I know, this should be impossible.
The browser should be sending 192.168.1.200 for SNI, not 172.19.0.4. It should work fine with the first Caddyfile, because that’s what your browser should be asking for.
Docker exposed ports aren’t terminating proxies, they’re just forwarding.
Something weird is going on, and I can’t quite put my finger on it.