what is the correct approach to define them or do I need to do this? Should I also use Variables tab to define them in advance and override the values later in the REST request payload?
You could invoke the REST API with queue time variables by parameters
directly.
The state in that post:
if values of pipeline variables will be changed during pipeline queue,
they cannot be defined in the pipeline YAML definition, but using UI
Variables panel and Variables tab in Trigger page.
It means that when you define variable in YMAL file, then you cannot modify it while queuing the pipeline, but if you defined it in the UI, you could modify it with queue time variables
However, we still could run Azure DevOps pipeline with YAML type via REST API with queue time variables.
As test, I create a pipeline with YAML type like following without any predefined variables in YAML or UI:
pool:
vmImage: 'ubuntu-latest'
trigger:
branches:
include:
- mster
steps:
- script: echo $(Test)
displayName: 'Do something'
Then I use the REST API with following request body:
{
"parameters": "{\"Test\":\"123\"}",
"definition": {
"id": 66
}
}
As rest, the pipeline is triggered and the output is:

Hope this helps.