As mentioned doing a "like" forces the database to scan, also the if statement complicates the query plan solution further
Can you rather select the data and do the contains on the app side?
var linkageData = query
.SelectMany(p => p.AddressBookLinkage)
.AsNoTracking()
.Select(linkage => new
{
MainContactId = linkage.MainContactId,
Name = linkage.MainContactId == null ? linkage.MainSubject.Name : linkage.MainContact.Name
})
.ToList();
var result = linkageData
.Where(linkage => linkage.Name.Contains(searchedTerm))
.ToList();