I am currently using the pipeline REST endpoint documented here to create my pipelines and associate them with a YAML file, but there is no setting for adding variables in the docs.
For reference the setting I am looking for is the one you add here in the portal UI:
I'm not looking to set up variable groups which can be done using distributed task endpoint here nor am I looking to add them to pipeline runs or build definitions which also have endpoints available documented here and here.
I just want to add them to the pipeline itself so that triggers tied to branch check-ins or manual runs have them available.
Unless I am not using them properly none of these endpoints mentioned are able to do the trick for me and I don't see any other options in the documents.

To use the Rest API: Pipelines - Create to create the YAML Pipeline and set the Variable in Pipeline UI, you can refer to the following Request Body:
Rest API:
Request Body:
You can define the Pipeline variables in configuration field.
Result: