As a tree grows new layers are added each year so that the trunk expands in radius. The living part of the tree is a relatively thin layer on the outside just beneath the bark, and the wood further inside is dead, just there for support. In trees that live long enough, some of the dead wood (heartwood) can be removed without harming the tree, leaving it with more than enough to support its weight. This can happen naturally, in the form of hollow trees.
Grown from scratch
In a hypothetical tree that could survive for tens or hundreds of thousands of years, it could take on the form of a ring that would be limited in height but continue to expand outwards surrounding an ever growing hollow. For a very large ring I would expect this area to be open to the sky. This suggests the possibility of a walled city where the wall is the very slowly expanding outer ring of a single tree.
Grafted to save time
A similar result might be achieved on a much shorter timescale by deliberately grafting small trees side by side along the required path of the city wall so that a single outer ring is formed without having to wait for all the inner rings to grow first. This would involve grafting trees side to side with vertical cuts rather than grafting the top of one tree onto the lower trunk of another.
Are these realistic?
Are there any flaws with either of these approaches to a city surrounded by a single tree? Are there any consequences that I have not considered that would limit this or require changes? Although the first approach would require a tree with a far greater lifespan than we see on Earth, I still want everything else to be realistic and consistent. The second approach I would expect to be realistic even on Earth, so I would like to know if there are reasons why this would not be the case.