According to the documentation of the
composer config extra.foo bar
Setting extra.foo does not exist or is not supported by this command
There is no way, and the reason is that this usually is bound to some very specific local use case that does not apply to the general audience.
All parameters that can be influenced with
composer config are listed here: https://getcomposer.org/doc/06-config.md
If you want to add data to the "extra" part, you have to edit it by hand or let your script do it in some other way.