Pardon the pun, but to fix this correctly, you have to get to the root of the problem! 😛
Roots will find sanitary (sewer) lines, older ones in particular that are in a state of disrepair. This is because the lines often have offset joints, leaks around joints, cracks, etc. These older, terra cotta (clay-like) pipes will exhibit this phenomenon in as little at 10 years from installation, sometimes sooner if the ground shifts or there is seismic activity present.
Anyways, once there is a slight breach in the line, a root will find its way in because environmental factors present in these pipes are highly desired for tree roots. Lots of nutrients (yes trees like your sh!t!), humid and warm air, etc. Once the roots find it, they will grow. Tiny threads that appear hairlike will grab on the insides of the pipes at first. These can often cause backups as large pieces of solid waste such as toilet tissue can get caught on them.
They are frequently discovered when the homeowner calls a pro to have the main line cabled with a cutterhead and root "hairs" are on the cable when it's pulled back. This service will restore the drain, but it is imperative to remember that the roots will grow back much faster and thicker when cut out of the way. If a root inhibitor is not used with frequency, a growback can be strong enough to damage the pipe bad enough where it needs to be replaced.
Replacement of the main sewer line can be quite costly and damaging to your landscape. This is something not to be taken lightly!
Cheers!