This was added in Python 3.9 as BooleanOptionalAction: https://docs.python.org/3/library/argparse.html#argparse.BooleanOptionalAction
This is the same enhancement request that torek linked. You can see the implementation here: https://github.com/python/cpython/pull/11478