Writing this in case someone finds this thread while fuming about why the hell they keep getting an obstruction error trying to build track through an airlock. I just fought with this for an irritatingly long time before resolving it, and learned two things along the way.
First, the terrain has to be perfectly flat in order for the track to connect to the gate- and not just at that gate but for some distance around. You may need to delete everything for a few hundred yards around and flatten everything to surface (option in the terrain tools). Side note: Stations require even more flat distance, more than is intuitive. If it still doesn't work after rebuilding:
Second, I discovered that the barrier sections either side of the gate can be the cause of the obstructions to the track. If you delete the adjoining sections, you can build the track through and rebuild the barrier. An alternative is to build the airlock before the rest of the barrier at all. Of course, these steps only work if you haven't already placed a habitat gate (reason #37 why you should never place a gate until 100% sure that all actual construction in the habitat is complete and satisfactory).
Hope this helps someone someday, and keep building!