Well, people rarely feel guilty before the action and rarely anticipate that they will feel guilty about a planned action. Guilt is an aversion, not a desire. People who choose to do something that they expect to make them guilty are edge cases and I do not think relevant to the general ontology of guilt, any more than people who eat poisons for fun are relevant to why people eat in general. In your assumption, the key factor is that actors believe their decision is the rational one, but you're sidestepping the problem of predicting the future accurately and consequences of the mismatch of expectations and result.
I think you are running through the collective intentionality question (you and me vs. us). I am participating in a discussion and you are participating in a discussion, but how is it that we can be participating in a discussion? Opponents of collective intentionality argue that this is a bridge that can not be logically crossed, that one (you) plus one (me) is indeed two (us), but neither one (you or me) is transmogrified into a two (us). Proponents of collective intentionality generally also argue this is a logical impossibility, but sidestep it by arguing that we simply have the ability to be both complex and simple simultaneously. Or to put it more simply, I know that we are doing a thing together and you know that we are doing a thing together so we both understand that we are doing a thing together while also knowing that we are still separate people outside the scope of the relevant behavior. The same thing can be done with statuses where it is more clearly removed from material phenomena, such as I am a blue blood and you are a blue blood and blue bloods know that blue bloods watch out for each other's interests before the interests of red bloods, so we are blue bloods as defined by our relative behavior to in-groups and out-groups.
Strictly social behaviors, such as guilt, are most easily understood in terms of signalling. A promises to do X, but the actual result is Y. B is injured by Y and signals the injury to A. A receives B's signal and responds with a signal. B responds to A's signal. A change in behavior occurs in one, both, or neither. This is complex behavior per se, so while the formulas are simple there is an indefinitely large number of potential results, depending heavily on the exact variables, initial conditions, and the sequence of events. B's injury signal is sensitively dependent to both the intensity of A's promise (reluctant to absolute) and B's particular valuation of the injury caused by Y, and to B's self-assessment of A's worth and relative social status, and so runs from dismissal of claim ("Didn't even notice, sir!") to disproportionate retribution ("I'll kill you, scum!"). A's response signal, which is an expression of the emotional response to B's signal, is sensitively dependent to B's particular injury signal ("Ow!" or "You SOB!"), to B's particular injury, to A's self-assessment of their own intentions in attempting X, to A's self-assessment of B's worth and relative social status, and to a great many other factors, and so runs from reversal of claim ("It was your fault, jerk!") to retribution ("I feel terrible, please take this."). B's response is likewise sensitively dependent to these kinds of factors ("What is your problem?!") and expresses their emotional response to the previous signal ("I['ll never] forgive you."). From a relatively simple set of possibilities, there is a practically infinite set of combinations.
The purpose is always to effect some kind of behavioral change, directly by causing an action or indirectly by changing the valuation of some thing. Because we are rational and aware of each other's rationality and desires and aversions, we can tailor our responses to prompt desired responses in others. This tailoring happens both consciously and unconsciously. Guilt belongs to a class of aversions that motivate people to avoid a previous behavior. Other emotions in this class are regret, shame, embarrassment, trauma, etc. All of these emotions are in response to phenomena/actions/events and all of these emotions affect the valuation of the phenomena negatively. These emotions are why we learn from failure. Not all animals do.