But they can get away without having the 404 in there.
As already noted in a comment: No, they cannot. Both of your examples mention 404 one way or another.
The context made it clear already.
Does it? At least in the Star Wars example, if I got to the error page from a search form, it would not be clear to me that there seems to be an actual error on the page (that tech support might fix if I contacted them), rather than this being just a case of my search yielding no results. (Well, it would be clear to me, because there is a big 404 there and I know what that means.)
Why do websites still have it?
You have to consider the different stakeholders for whom usability has to be optimized here. Maybe surprisingly, I see three groups:
- Visitors of the website: They need to be able to navigate the website autonomously. When they encounter the 404 page, they should understand what's going on; at the very least, that they cannot find the resource they expected here and should go back. Imaginative explanations may help keep these people in a good mood despite running into an error.
- Tech support of the website: They need to be able to quickly figure out what is the precise issue, both to fix it and to respond to the visitor in a satisfactorily accurate and fast manner. To them, a unique error number (or letter code, or whatever short identifier can be relayed to them by the visitor) is a lot more helpful than a free-text message (that, due to its natural language nature, even has some risk of being misunderstood and/or rephrased by the user).
- Visitors of the website in touch with tech support: They need not understand what is going on except that there is a technical issue1. What they do need is a clear indication of what they have to tell tech support in order to get quick and accurate help. Tech support might ask for the exact message the visitor is seeing, but as noted above, there is still a slight risk the visitor might rephrase the message (beside an entire message being possibly cumbersome to type into an e-mail or read out on the phone)2. If a short unique identifier of the problem, such as the error code 404, is displayed in an unmistakable way (as in, explicitly labeled "error code:", with support asking for the "error code displayed on the page"), there is little chance of this part of the communication going wrong.
Therefore, my conclusion is: Yes, it is needed, but it should not be the only thing displayed on such a page.
1: Don't get me wrong, they have every right to understand what is going on if they are interested in it. But if they do not care beyond the mere fact that there is an error, this is totally fine.
2: This can be especially problematic if the original message displayed by the website is already misleading or ambiguous. For instance, another answer here suggests the text "The page you are looking for is not under our radar." Now, to be "under someone's radar" is derived from the working principle of some kinds of radar that might not detect certain objects close to the ground, which can thus go unnoticed. Accordingly, the term is sometimes used figuratively to express that something remains unnoticed, invisible. The page not being under the website's radar might thus be paraphrased as "The page was successfully found.", which will totally confuse tech support staff.