The scenario described is safe a certain number of times, however, if this activity is repeated enough something will fatigue and break or wear out.
The fact that you can travel such a rock/root section at speed with a given bike doesn't mean you should. A Cross Country bike is normally optimized for weight and have a geometry that is more oriented to be efficient when pedalling. This is important because of the fork angle and head tube structure. Your bike has a "more upright" angle compared to a Downhill bike. When the wheel hits a root, the impact is very close to perpendicular to head tube, putting a lot of stress on the crown, particularly the crown-steerer joint, and on the headtube, specifically the joints with the top tube and the down tube.
The bike can survive a number of abuses, but eventually material fatigue will kick in and one of the joints will develop a crack. Once this happens the piece is lost, the crack will expand progressively more with each hit (even the smaller ones) until catastrophic failure.
A DH bike in contrast will have a less steep fork angle, which in part allows it to absorb (a bigger) part of the horizontal impact through it's travel, and this impact won't be as close to perpendicular to the angle of the head tube. Both differences help reduce the load the parts have to bear with. Add to this that a DH bike is reinforced in key parts, including joints (they are beefier, thus heavier) and will usually have a dual crown fork.
An All-mountain bike would be somewhere in-between and would be better suited for root sections like the ones you describe, because they aren't as heavy as a DH bike and are still designed for better pedalling than a DH bike; they are heavier than XC bikes though.
If in your habitual routes there is only a few root sections, the you may be better simply slowing down before the beginning of the section, and traverse at a controlled speed at which you feel confident on both your technique and the bike's endurance.
You can also improve your technique. I suspect you are already doing this, but for other riders that get here: Position yourself centred on the bike, stand up on the pedals but keeping the knees bent (i.e. just lift your butt four-six inches from the saddle, do not fully extend legs), pedals at the same height, Arms bent with elbows pointing outwards. This position allows you to complement the suspension, effectively using arms and legs as a suspension. You must have a firm grip but not be tense.
Another point is: If you are braking when you hit a bump, you increase the load on the parts. It is better to release the brake and apply it when the tire is on a more even patch of terrain. Of course this is not possible if the roots are too close one another, that's why I recommend regulating the speed before the root section, so you keep brake usage to a minimum on the most critical segment.
No suspension is capable of doing ALL the work, you've got to help it, think of yourself as a form of "active smart" suspension. This means for example that when you know you are going to hit a root, you prepare your arms and try to move the wheel up just before the hit, and then down to the ground again after reaching the top of that root. The same can be done with the legs. This is an ability that takes time but is really useful for riding bikes with little or no suspension on rough terrains.
However, there are combinations of terrain and speed that simply exceed a bike's designed capacity. If possible, upgrade to a full suspension XC bike or an All-mountain one. You'll find yourself riding more confidently on more technically challenging trails.
Suspension travel used as you note, is a good measure, assuming the suspension is well adjusted and your technique is right. 10cm (100 mm, 4 inch) is a good travel for an XC fork, thus a 10 cm root completely out of the ground is practically the most it can take without help from the rider. An AM bike should have a fork travel in the 130mm-170mm range.
In my case: I'm an XC and DH rider, and have a hardtail, a full-suspension and a DH bike. I can ride any of the DH tracks I know even with the hardtail bike, (except jumps and drops) but to do it safely, I have to keep a moderate speed on technical sections. The first signal I get when riding to hard on a too light bike are the pinch flats, (and I ride them to 40psi minimum) so at that point I know I am close to the bike's limits.
If you are interested, in this answer I cover more of the technique for descending faster and more confidendly: What skills/drills should I learn to descend faster and more confidently? (for mountain biking)