No. That won't work. Every carrier has it own way to generate tracking number. And that number must have registered in the carrier's database before it becomes "valid/sanctioned".
If you generate a random number even fitting the pattern and looks like a real one, the scan will fail with an error and fail to register tracking information every single step of the way that package gets scanned from dropoff at the retail postal office (this was the case) as bulk inbound pickup from USPS are only allowed for USPS verified partners.
Label creation (which generates the tracking number) is a billable action in their API. Some volume partners have pre-arranged/allocated tracking number segments assigned to the bulk volume partner/shipper (similar like how IP address v4 is assignment from IANA). And that pre-allocation tracking number range requires $$$$ contract in place. Billing that is post paid like cellphone bill.
Most retail shipping software (like shipengine, pirateship etc.) bills using the prepaid method, meaning you will have to pay for the label at the time label is generated.
Disclaimer: I used to work for a carrier that integrated a few dozens of global shipping carriers.