I am unable to independently verify the claim, but in Stalin vs Gypsies
Roma and Political Repressions in the USSR (Brill, 2024), the authors Elena Marushiakova
and Vesselin Popov trace the source of this phrase (or "meme" as they term it) in the book's final chapter "The Winds of History: Instead of a Conclusion" (pages 309 - 407).
According to Marushiakova and Popov the phrase "half of the country is dwelling [in prison], the other [half] is guarding it" is a misquotation of a statement made by Akhmatova, recorded in Lydia Chukovskaya’s memoirs about her: "Now the arrested will return, and the two Russians will look at each other’s eyes: the one who imprisoned and the one who was imprisoned” 1. The statement was apparently made as a comment on Nikita Khrushchev’s report of 1956, which began the prcess of exposing Stalin’s personality cult. The authors go on to observe:
The shift from the “two Russians” to the “two halves of a country”
(which are two very different things) originates from the book Boys
in Zinc by the future Nobel laureate in literature Svetlana
Alexeevich... and has become an extremely popular meme in the public
space.
They thus ascribe the distorted version of the phrase as originating from Alexievich herself.
While I have not been able to find a copy of the Akhmatova Journals online, I do have access to Boys in Zinc (or Zinky Boys), but I have not been able to find a quote there similar to the one claimed by the authors above. I wonder if they actually meant to refer to Voices of Chernobyl.
In a comment, kostix was able to obtain Chukovskaya’s actual quote from The Akhamatov Journals:
Теперь арестанты вернутся, и две России глянут друг другу в глаза: та,
что сажала, и та, которую посадили.
which translates as:
Now the prisoners will return, and the two Russias will look each
other in the eye: the one who imprisoned, and the one who was
imprisoned.
This is similar, but subtly different, to the quote reported by Marushiakova and Popov. Note how the original refers to "two Russias", rather than "two Russians". This brings the meaning much closer to the phrase Alexievich quotes: "Half the country imprisoning, half the country imprisoned".
So in summary, it appears that Akhamatov is indeed the source of a quote very similar to that used by the historian in Voices of Chernobyl. It can be found in Chukovskaya’s Akhmatova Journals, and its context was Krushchev's "Secret Speech", in which the rule of Stalin was criticised within the USSR for the first time.
1. Записки об Анне Ахматовой (The Akhamatov Journals), 1997, Vol. 2, p. 190.