which allows me to get the previous page URL, however this function does not always work as sometimes the link comes from external sources (email, banner, google search ...)
If your metric its really working as well, you can create a segment that: your "eVar" does not contain "your domain" the operator: "Then After 1 Page view" Entry page=/404. Do not forget to choose the option: "Only before the sequence". There's an example:
So, after that you can go to workspace and use your segment, with your eVar, that you still need to filter the data, using "Does not contain: mycompany.com" (This is important). To have a better comparison, you can use the metric "Ocurrences" in the side:
As you can see there's no relevance in external links to 404 error in my company website.