In "Once Upon a Time," Nadine Gordimer uses a razor-wire topped wall around a single-family home as a metaphor for South Africa's apartheid. Like the family in the story, which is trying to stay "safe" by turning its room into a fortress, the white minority in that country was, at the time, trying to keep itself "safe" from its black majority by strictly separating blacks and whites. Blacks had to live in different areas, attend different schools, and were cut off from most of the amenities of modern life, while the whites lived in great comfort.
Gordimer very much opposed apartheid, and the story becomes a cautionary metaphor for how the entire white society is going to end up ripping itself apart, destroyed by social structures meant to keep it safe, just as the little boy is ripped apart by the razor wire that is supposed to keep him safe.
The motif of the fairy tale is another metaphor for South Africa's apartheid. Gordimer is likening the way the whites live to living in a fairytale. All the safety and security they think they are buying for themselves is nothing but an illusion. Just as the family is less safe because of the razor wire, so white society is less safe, not more, because of the cruel social structures it has established to keep blacks out.
This metaphor can be extended universally, as the story is carefully not set in any particular place and time. Is building a wall to keep a feared 'other' out ever going to make people safer or is that whole idea a fairytale illusion?