Yes, that's my point, although I can see why you interpreted it otherwise.
mitmproxy's API is flow.response.get_content(strict=False), which returns a bytes object; the proof-of-concept script then copies it into the bytearray using the code that I've cited.
Byte objects are immutable, but bytearray objects are not.