1. Loki does all the things that get the TVA to recruit him to catch himself in between getting free and agreeing to help.
2. The Loki the TVA are after is actually doing what he's supposed to be doing, and ultimately so is the Variant. The Variant will end up taking main Loki's place being killed by Thanos, and main Loki will then do the things that get the Variant recruited. All praise the Sacred Timeline.