Alter Header Status Response to 410
Yes, definitely higher up. When you are already inside of a 404 subrequest it is too late.
You could put the code in on404() of an HttpExceptionSubscriber, check the path and then replace the 404 with 410:
$event-&gt;setException(new HttpException(410));

See https://drupal.stackexchange.com/a/231263/47547