Self-regulating jets during the common-envelope phase