If i can generate a wallet and corresponding private key offline, and those can fit in the blockchain when I go online
Correct.
does it mean that there is a certain formula between a wallet and the private key?
A wallet can hold one or more addresses and private keys. There's no formula there.
A private key is generated
at random, and the address is derived from the private key.
Can people use that formula to get my private key simply knowing my wallet address?
No. If you generate the private key in a proper way, nobody can steal your funds.
How can an offline software create valid private key/public key pairs without communicating with the blockchain? The software must on its own know a certain private key would match a certain public key. Doesnt it mean there is a calculable relationship between private key and public key?