Why getrawtransaction returns an HTTP STATUS CODE 500 for not found transactions?
It should return HTTP status 500 if the transaction doesn't exist. 404 is just for method-does-not-exist errors. (See here.) Reading the code, I don't see how error 404 could be returned for a transaction not existing. (I checked the current code and 0.13.)

HTTP status codes are pretty non-specific. You should parse the JSON response if you want something more specific than 'an error happened.' (But it doesn't always return JSON. IIRC, 401 Authorization errors aren't JSON.)