Q. Is it grammatically correct to say that “a nation or a society built a barrier or a wall”? Is it implied that we are talking about the citizens doing the building?
A. Yes and yes. The grammar is fine, and in English it’s normal to say or write expressions that are not meant to be taken literally. We sit on a jury. We stand on a principle. The United States sent a rocket to the moon. The Chinese built the Great Wall. (And incidentally, grammar isn’t the issue. “Its hairline breathed in desks” has perfect grammar, as does your sentence. The question is one of idiom rather than grammar.)