The speculation is the walls serve two purposes, to keep people both out and in.

The project in Vietnam

  • a 4.5-metre-high iron fence, topped with barbed wire, along the Beilun River.
  • Built between 2012 and 2017
  • reportedly stretches 12 kilometres
  • It continues to be extended as additional phases are rolled out

Myanmar:

  • 659-kilometre-long fence has reportedly been completed along China's 2,000-kilometre border with Myanmar in December

Here is the report, an interesting read.

The speculation is the walls serve two purposes, to keep people both out and in.