Look at 6-1-6 and 6-1-8. If a free kick is caught or recovered by the kicking team, the ball is dead and belongs to the receiving team unless the kicking team is in legal possession. Because this kick had not gone 10 yards or been touched by the receiving team, Team A is not in legal possession. Therefore, by 6-1-6, the ball belongs to Team B at the A-44 by rule. Since the dead ball belongs to Team B and there is a foul by Team A, it can be enforced from the dead ball spot. It will be Team B’s ball at the A-39.
This is not enforcing from the illegal touching spot, it is enforcing from the dead ball spot. They just happen to be the same in this particular play.