WordPress media library allow uploading fake file

If the file isn’t an image, its mime type is checked against the allowed list.

As your example would generate a text mimetype, and it’s an allowed file extension, it passes through. There should be no concern unless your server is executing image files as PHP, in which case this issue is the least of your concerns.

If you consider it a bug though, you should open a Trac ticket, this isn’t the place for reporting WP bugs