The file is generated when you run npx cap add android, but it only includes the variables that Capacitor itself uses.
You don’t really need to add those variables, the plugins document the name of the variables they use and the default version you use, so you only need to add the variable to the variables.gradle if you want to set it to a different version, in example if you have another plugin with the same variable but with a different default value which makes them to conflict.
It looks like you are using Capacitor 5, so you should be using version 5.x of the Capacitor plugins, which have different variables versions than the ones you mentioned.
In example push notifications plugin on version 5.x uses firebaseMessagingVersion 23.1.2