I have owned 6 Subarus now and do not recall ever having to get a head gasket replaced.
You must be very lucky or do drive them long enough to incurr the problem. Head gasket issues on the boxer engines from Subaru are well documented.
Owned 2 Subarus: a legacy wagon that I drove to dealership with 285 k miles after being t-boned and passenger side stove in. Traded for 2016 Impreza sedan
Still driving that with 185 k. Ery minimal repairs. Mostly maintenance only. Great AWD in Michigan Winters.