connection: Fetch use_ka and writeme from the main connection into a new one.

This allows, in theory at least, a passive world's use_ka and writeme flags to
apply to all connections made to it. It's a little sneaky, and relies on the
transient state and the template state using the same names, and also relies
on the two states not colliding anywhere. But it works.