All trees will spread roots out as they age. Most trees will spread roots to mirror the size and shape of the natural unpruned canopy. Root barriers do help with some plants like bamboo, but that also has a limited life and the runners will go over if they can. I did misread the post. Trimming the top will not stop the spread of the roots. Trimming or placing a root barrier will hurt the tree unless the canopy is also cut back.
You either have to select the right tree for the right place and give the tree the room it needs to spread.
Most people here don't realize that a small tree can still get up to 30 ft in height. We have small yards, what most people need are really shrubs not trees. Shrubs can get up to 20 ft and spread 10 ft wide. You have to live with the tree for a long time and it can outlive you so pick the right one.
I chose a crepe myrtle for my yard and I kept it in the pot for a lot of years. It was already a dwarf crepe myrtle and it has actually survived despite my neglect (I think it is almost 20 years old). It is about 8 ft tall and it blooms in summer and it is seedless so no sprouting seedlings all over the place. The tree is where the falling flowers just become mulch so they don't mess up sidewalks. It is called Little Chief.
The only other trees I have in my yard are bay leaves which grow in a columnar shape so don't need a lot of pruning. They are edible and they have non invasive roots. I have three plumeria trees that came with the house they also have fibrous non invasive roots. The last tree is a native gardenia, Nanu or Nau, which I did not realize was a tree gardenia until it was on its way to becoming a twenty foot tree. Most native nau are a lot smaller grown in cultivation. I topped it at 5 ft but it also has non invasive roots. The citrus trees are invasive so they are kept dwarfed in pots. I have to kill the ones that escape. I finally killed one bougainvillea that escaped.
I did have a nice rubbish tree in the front yard when we moved in, but after 30 years it started to reach out to the house foundation and wrap around the water pipes so it had to be removed. It just outgrew the yard. It did not help that the tenants that rented the house for three years never watered the yard and it caused the tree to develop weak branches and forced the roots to come up shallow.
https://hirts.com/little-chief-crape-my ... -10-seeds/
https://ag.purdue.edu/fnr/urbanforestry ... ection.pdf
Happy gardening in Hawaii. Gardens are where people grow.