How to allow to add gradients to core/heading block?

No, currently gradient support in the heading block has not been implemented.

You can declare that it supports it in theme.json or via supports, but there is nothing in the block to read that data in and use it. Gradient support has to be built into a block, it can’t be inserted arbitrarily.

The closest you can get is with predefined variants or styles, a custom block, or wrapper the heading in a group/cover block. Composition not modification.

tech