What is a Maginot Line? Why does Gene mention it in the end?
This comes as Gene's final reflection on his relationship with Finny and his time at Devon. His stream-of-consciousness shows his internal censorship, and his attempt to come to terms with his life.
Only Phineas never was afraid, only Phineas never hated anyone….All of them, all except Phineas, constructed at infinite cost to themselves these Maginot Lines against this enemy they thought they saw across the frontier, this enemy who never attacked that way – if ever attacked at all; if he was indeed the enemy.
The Maginot Line was a defense structure that France built along its border with Germany and Italy during WWII, which included concrete walls, machine gun posts, artillery casements, and tank obstacles. The idea was to deter a direct assault on France, thereby giving them enough time to muster their army. This approach worked...kind of. Germany didn't attack France directly, but did attack Belgium, skirt the Maginot Line, and invade the country anyway.
In the novel, we can see the connection to Gene's memories. Essentially, he is admitting that he imagined Finny as an enemy, one who never actually attacked Gene; in fact, Finny never considered Gene anything other than his best friend, and certainly would never hurt him in any way purposely. So, for Gene, his defenses against Finny were all for nothing, much like the Maginot line. Gene also imagines that all the boys at Devon (except Finny) constructed these defenses against each other, but all for nothing. His last thought is that perhaps the true enemy was inside each of them all along.