If you complete a companion's quest line and get their special perk and then respec your character, you lose the companion's special perk for good. You do get an extra perk point to assign, but the special perk itself is no longer available for them at all, and there appears no way to get it back. This is a hidden cost, and a very critical one, to respeccing.