While adjusting my rear shifting cables I noticed that the small piece of housing, which emerges from where the barrel adjuster is threaded in, was broken. Is it necessary to replace this or is it fine to leave it as? If I should replace it, what is the part name I should be looking for.
It's there to reduce friction when the derailleur is in its extreme positions and also to prevent contamination of the housing. It's not totally necessary, but if it's broken in a way where it can't do that anymore, replacing it will improve performance.
It's unfortunate that the first generation Shimano road 11 rear derailleurs were built to need them to perform well, but they do.
Shimano sells them. I believe their part number Y5XX38000 is a generic replacement for all the derailleurs that have it.
You can also remove it completely when the housing is out and replace it with any sufficiently long nosed shift ferrule to accomplish the same thing. It doesn't have to poke out as much as the original, only enough to route the cable around the bend that gets created in the extreme positions.
Most likely you are fine to leave it as-is.
It is actually not housing but rather the housing end cap with tongue.
The theory of the tongue is that it will prevent dirt ingress to cable housing, thus keeping your shifting reliable over time with no need to change the cables and housings regularly.
Long time ago, road bikes used end caps with O ring on the chainstay cable loop and unsealed end caps elsewhere. It worked just fine. But back then cog pitch was around 5 millimeters with 8 speeds and cable pull ratio was 1.7 so cable pull per shift was around 2.9 millimeters. Plus, back then exposed cable runs were the norm.
Then someone thought that hey, let's make bicycles need more frequent service and let's make the service more expensive as well. The way to make bicycles need more frequent service was made by introducing ridiculous 11-speed cassettes that have cogs so thin they wear away in no time, and cogs so densely packed that they had 3.7mm spacing. The way to make service more expensive was by introducing internal cable routing, a totally ridiculous feature only making it practically impossible to easily replace the cables and housings.
With the 1.7 cable pull ratio, 3.7mm spacing would mean 2.2mm per shift, a so small value the shifting would be unreliable. Not only that, but if the internal cable routing has housing for the entire run of the cable, cable friction skyrockets. Not feasible. Fortunately, Shimano has made the ridiculous 11 speed cassettes and internal cable routing more feasible by changing the cable pull ratio to 1.4. Then the cable pull per shift is 2.6mm, far closer to the 2.9mm ideal of 8-speed systems.
The newer systems that have 11-speed cassettes very closely spaced and internal cable routing with housing for the whole run of the cable are so sensitive to friction that Shimano has introduced new ways to combat dirt ingress to the inside of the housing. The housing end cap with tongue is one of these ways. Also you'll find that today's systems use "Optislick" inner wires having a faint blue color that are far more expensive but have minimally lower friction.
Next time when you notice your shifting has degraded and replace the cables and housings, put a new end cap with tongue there. Oops, you can't do that easily anymore because of the internal cable routings!