Lucky you
Your panels are set up very advantageously to put in a generator transfer switch. All the loads you want to switch (but one) are already in a subpanel. This makes this super easy. It's almost like somebody planned it... Except the guy who put the pump circuit in the main panel did not get the memo.
You need to put a different transfer switch in between the two boxes. There are a couple ways to do this.
One is fit the subpanel with a manual interlock switch. This is a listed (offically tested) modification to the subpanel where it puts two breakers opposite from each other with a sliding plate so they can't both be on. Simple and cheap, and you may even be able to retrofit your existing panel. Must be thrown manually.
The other way is to pick a spot along the cable between the panels (or elsewhere if you don't mind rerouting cable), cut the cable, and insert the transfer switch inline. This will work with any kind of transfer switch, including automatic. You'll need to cut the cable on one side with enough slack to work, and the other side will be too short so you will have to replace that "half" of the run. So choose location and cut point very carefully to your advantage.
That one breaker in the wrong panel
The stuff you are imagining, you cannot do anything like that. In that approach, the options are break the law, backfeed the grid and kill linemen; or spend a king's ransom on more heavy cables than the underside of an NYC subway car, in a veritable Gordian knot of transfer switch wiring that nobody will be able to figure out after the fact. And the power company and inspector will absolutely hate it.
The right way is easy, if annoying: move the circuit to the subpanel. Extend the pump circuit, all wires, to the subpanel and land it on a double breaker, ground bar, and neutral if used. Do not continue to use the ground in the main panel, in fact if you make this splice inside the main panel, tape the ground wire with green tape to insulate it from the main panel. It's not the end of the world if it grounds accidentally, but grounds must go to the same panel the hots do.
I know that's a pain, but it's way less of a pain than anything else you could do legally.
Not room in the subpanel?
This happens a lot, some guy drove back from the subpanel store slapping himself on the back for saving $30... by buying barely enough spaces. Don't be that guy. You're going to need 6 right off the bat - 4 for the transfer switch and 2 for the well pump.
Worst case you may need to replace the subpanel, and fortujately that is DIY-possible because you can entirely shut off the panel at the main breaker. Also a great time to be looking for transfer switch friendly panels if you want to go that way. Don't scrimp - slap yourself on the back for buying twice as many spaces as you need today. The bigger panels often come with "bonus breakers" which save you some money too.
Best Answer
The correct solution here is a smallish electrical panel
Were I in your shoes, I would have a small-ish electrical panel (8 or 12 space, 200A bussing) in the shed to provide a home for the service disconnecting means -- having rule-of-six shutoffs here due to the multi-building nature (presuming the garage is attached and the shed separate) of this system. The inverter can feed a main breaker or backfed main in the panel for now, and when the house is ready, the main breaker can be removed, using main lugs to feed the panel and allowing separate shutoffs for the house and shed.
If you want a single-main-disconnect solution -- that's possible as well, using an 8-space 200A panel with feed-thru lugs (called a "mobile home panel" sometimes). The main breaker is fed from the inverter, while the feeder to the house is tapped at the feed-through lugs, and the shed circuits fed from the panel breakers, or a subpanel on a feeder breaker there.