I'm actually hoping for "software only" solution, a little switch: USE BOTH. WiFi and 5G, something that would say:
use 5G always to boost the WiFi
Or maybe some machine learning (if / else statement), knowing the exact distance from the router, and if increased by 5 meters in the last 2 seconds automatically fire up 5G.
Definitely doable. Am I missing something obvious?
5G/LTE ≠ WiFi
I don't mean to sound dismissive or flippant, but yes, you are missing something quite obvious: a fundamental understanding of the differences between 5G/LTE and WiFi bands (radio frequencies). You're also missing the fundamentals of routing and having a multi-homed network.
The only thing these two technologies have in common is that they use RF as the transmission medium. The technologies and protocols to get connected to are vastly different. To further complicate this, you can't (shouldn't) have two independent gateways to the Internet (multi-homed gateway) running simultaneously. From a purely networking perspective (ignoring the radio transmission portion of this), having to connections introduces all sorts of issues like which interface is traffic routed through, how does the firewall handle the sessions created, etc.
use 5G always to boost the WiFi
It's not clear what you're attempting to accomplish here as the technologies are too disparate for one to "boost" another. This is like saying you want a motorcycle to boost your car - it makes no sense.
Connecting iPhone to both WiFi network and 4G/5G simultaneously...Someone asked some time ago and I cannot believe it is not sorted...
It is/was sorted, already. The Apple Discussion you linked has been, in fact, answered (correctly) and it applies to this question as well:
You can't simultaneously have multiple Internet connections. This has nothing to do with the current date or whether other folks experience the issue - only one gateway (connection to the Internet) active at any time. It comes down to you having two different radio bands (2.4/5Ghz spectrum and GSM/LTE), both acting as the default route for your Internet traffic. Nothing is going to "switch" until it becomes disconnected.
...Or maybe some machine learning (if / else statement), knowing the exact distance from the router, and if increased by 5 meters in the last 2 seconds automatically fire up 5G.
Even if this were a plausible solution, *just how are you expecting to operate at the firmware level to implement this "machine learning algorithm" (rhetorical)?
The problem in a nutshell...
...as I walk around the garden, it loses the connection. The simple workaround is to have WiFi extender. I'm actually hoping for "software only" solution,
That is the answer: a WiFi extender.
The problem you're trying to solve is a weak signal at a particlar location in your garden. It could be from just the location or you have enough corregated metal and/or chicken wire strung in that area such that there's a faraday cage effect being created. Until a proper site survey can be done, we can only guess. But, what we do know is that your phone has a physical obstacle in making a strong and clean connection to the WiFi radio(s). It's a physical problem and the solution needs to be a physical.
TL;DR
Someone asked some time ago and I cannot believe it is not sorted: https://discussions.apple.com/thread/254808545?sortBy=best
It has been sorted - get a WiFi extender. You're over complicating things with this handoff type switch on the node rather than at the network. Switching networks (two completely different networks at that) is not as simple as you may think it is. Everything from the IP, the DNS, the saved session states within the firewall will all break when you switch in this manner.