Applying `TrigToExp` only for terms containing certain variables

Does this suit your needs?

expr /. {x_[y_] /; 
    And[MemberQ[{Sin, Cos, Tan, Csc, Sec, Cot}, x], 
        Length[Position[y, b]] > 0]
    :> TrigToExp[x[y]]}

Searches for trigonometric functions which contain b in their parameters and expands them.


Replace[expr, h : Except[_[_?(FreeQ[b])]] :> TrigToExp[h], ∞]

-I E^(I b) Sin[a]


Here's another variation, where I inactivate trig functions that don't contain b:

$trigs = Sin | Cos | Tan | Sec | Csc | Cot;

Activate @ TrigToExp @ ReplaceAll[
    expr,
    (h : $trigs)[x_?(FreeQ[b])] :> Inactive[h][x]
]

-I E^(I b) Sin[a]