In my following reasoning I will separate the why and the what.
TLDR
For the question of why there are two logical qubits, you do not have to worry about loops. It's simply number of physical qubits minus number of independent stabilizer generators.
For the question of what the logical qubits are (or rather their corresponding logical X- and Z-operators), the loops are essential. The loops are the logical X- and Z-operators.
Why 2 logical qubits?
The number of logical qubits $l$ in any stabilizer code is the number of physical qubits $n$ minus the number of independent stabilizer generators $k$ of the code, so: $l = n - k$
Having a $L \times L$ grid (as in the blog post) means that you have $n = 2L^2$ edges (which correspond to physical qubits), $L^2$ vertices (which correspond to Z-stabilizers) and $L^2$ plaquettes (which correspond to X-stabilizers)
The $L^2$ Z-stabilizers are not independent. You can choose one of them to be the product of all others. The same goes for the X-stabilizers. Hence, we have $L^2 - 1$ independent Z-stabilizers and $L^2 - 1$ independent X-stabilizers.
We gather that $n = L^2$ and $k = 2(L^2 - 1)$ and thus $l = n - k = 2$
What are the logical qubits
In any stabilizer code, the logical qubits can be identified via pairs of logical X- and Z-operators. And they must meet these conditions:
- for a specific qubit, its logical X and Z anticommute with each other
- all other combinations of logical X and Z commute
- logical X and logical Z commute with the stabilizer
The non-contractable loops that the author lays out in the section Loops on the surface code are the logical X- and Z-operators.
You can verify that they meet the above described conditions.
Remember: identifying the qubits via their logical X and Z is a key concept in any stabilizer code.