This is the FIFA rule, so I’m still a bit confused how this is allowed:
Players may be registered with a maximum of three clubs during one season.
During this period, the player is only eligible to play official matches for
two clubs. As an exception to this rule, a player moving between two clubs
belonging to associations with overlapping seasons (i.e. start of the season in
summer/autumn as opposed to winter/spring) may be eligible to play in official
matches for a third club during the relevant season, provided he has fully
complied with his contractual obligations towards his previous clubs.