Why do some outgoing IP traffic not contain UID information?

Solution 1:

One of the usual reasons is the terminating FIN ACK sequence. Once a client application calls close() on the TCP socket, an ACK + FIN packet is sent to the server and the client program exits. At this point, there is no process associated with the TCP connection but it is not finished yet.

When applying an owner filter, it is customary to also add a rule to ACCEPT packets with state ESTABLISHED to cover these "residual packets".

iptables -A OUTPUT -p tcp --dport 443 -m owner --uid-owner foo -j ACCEPT
iptables -A OUTPUT -p tcp --dport 443 -m state --state ESTABLISHED -j ACCEPT