I tried to insert checks in the front of LookupResult::isAvailableForLookup() and other similar places in SemaLookup. But it can't address the above issue correctly.
So I think it may be best to make the entities to be hidden from the lookup from the beginning.
@iains I know this may interfere your current work. So I ping you to wish this one won't bring troubles to you. And I'm wondering if we can implement P1815 simpler by similar methods. (I tried this can't implement P1815 precisely)