Can Preston Garvey's perk still be obtained if he cannot be your companion?

I've unfortunately fallen into the glitch scenario with Preston Garvey, described in a fewotherquestions, where dialogue can't be initiated, and therefore he cannot be my companion. I don't have any viable pre-Castle mission saves to revert back to.

However, I've noticed that if he is nearby when doing weapon modifications, I'll still see a "Preston liked that" notification, so I'm seemingly still gaining affection with him. Doing this enough times should max out affection, so would his perk be obtainable in this glitched state? Perhaps by:

Obtaining it when his affinity maxes out, even though he is not my active companion, without the need to have the 'idolized' affinity conversation?

Allowing an affinity dialog to occur between affinity levels, even though all other dialog is not working with him?

Can you get Preston Garvey's perk, even if he is dialog-glitched and cannot become your companion?