Next month I am traveling to country X, where I would need Y minutes of calls, Z text messages and most importantly Q megabytes of data. How can I find the cheapest/most reliable SIM card for my needs?
Your best bet is to check the massively useful website called "Prepaid Data SIM Card Wiki". They have an article on pretty much every country in the world and it's kept relatively up to date thanks to their volunteer editors.
After you visit country X and check out their prepaid offers, make sure to go back to the Data SIM Wiki and update the respective article if something is missing or outdated, so that future readers can use your experience as well.
For your usecase I would consider getting a phone which supports eSIM. This will at least in some countries put your in a position to sign up with a GSM operator purely over the Internet (which also means: prior to arrival) and have your plan activated when you arrive. This can be handy if you arrive in places or at times when shops are not open or hard to find.
Yet in some countries GSM operators require a proof of identity in order to sign you up, like Germany or Switzerland for example. In that case, the eSIM enabled operators will usually also allow you to do some kind of remote identification, so you can still prepare prior to arriving.