> On encoding the utf-8-sig codec will write 0xef, 0xbb, 0xbf as the first three bytes to the file
https://docs.python.org/3/library/codecs.html
The codec you're imagining would also make reading a file and writing it back change the file if it contains a BOM.