2 Answers
2

Like others have said you can't use pre get posts since there is no way of knowing if the search returned any posts. I would also say that the if else is a very clean way to do it and might be the better choice if anyone else is going to be working on this.

But if you really wanted to do it with a filter on either the posts_results or the_posts to return the replacement posts that should be shown if the search is empty.