If the sauce was smooth before the cheese went in, take the pan off the heat before adding anything else. If you still see distinct shreds, give them a moment in the warm sauce and stir gently. A splash of milk can loosen a thick sauce. Once it looks oily and grainy, bringing it to a boil can make the texture worse.
For the next batch, finish cooking the sauce base first. Pull it off the burner, add the shredded cheese a handful at a time, and stir until each handful melts. Ask whoever makes your favorite macaroni, “What cheese do you use, and is the pan still on the burner when you add it?”
Search “cheese sauce off heat” for a demonstration of that step.