Can Preston Garvey's perk still be obtained if he cannot be your companion?
No he can't. Preston must be your active companion. Only then he can talk to you about your relationship. You still can get notifications like:
"Preston tolerates you"
"Preston admires you"
"Preston idolizes you"
But affection events are triggered only when character is your active companion.
For PC players, you can try console command to make target your companion:
setplayerteammate 1