The rulings on mosque entry and tawaf appear together, but they involve distinct legal considerations. Mosque entry concerns the sanctity of the prayer space; tawaf is a specific act of worship with its own conditions.
The prohibition of tawaf is not adequately explained by physical walking in a mosque alone.