The comments from glls are referring you to the Metadata API's
InstalledPackage entity. You can construct a Metadata API deployment composed exclusively of these entities, which define the version number and namespace of the package you wish to install, as a step prior to pushing your code.
The XML metadata looks like this (from the documentation above):
<?xml version="1.0" encoding="UTF-8"?>
You can’t deploy a package along with other metadata types. When you deploy InstalledPackage, it must be the only metadata type specified in the manifest file.
so what you'd probably want to do is build a separate directory with your
InstalledPackage files and run
sfdx force:mdapi:deploy against it to request the installation of those packages in your org prior to your SFDX push.
Alternately, you can script the CLI via the
sfdx force:package:install --package 04t... command, but you'll need the
04t package version Id for each package you wish to install.