Ooh, this is very similar to the autonomy frameworks for mission planning reactors we're coordinating for Mars Rover missions in the Space Agency. The aim within ESA and the agencies is to create rovers with greater amounts of autonomy, so that they can process their own mission requirements and then plan the sequences of actions needed to fulfil them.
Essentially the robot has to have some understanding of its higher strategic goals. This may be "deliver cake to my Boss" or "I must deliver cake to the Orphanage to feed the starving children" or whatever. This goal is probably intrinsic ie it's either received this higher goal from Ground Support (ie a human) or it's been generated internally, which means that in turn it's serving an even higher goal (ie "make the orphan children strong so they can CONQUER THE WORLD" etc).
In any case, the robot has the goal. It enters the cake shop and through its object recognition and sensors and reactors becomes aware that there is an object of interest (Cake) but that there are hazards or obstacles in the way (the owner) and begins to plan and re-plan accordingly.
So in answer to the questio it's not an abstract thought as such, but simply a series of plans, executions of those plans, and stopping the plans and replanning when something gets in the way. For Mars rovers this would be something like:
ROVER GOAL: Head to cached supply of Mars Rock
> Plan path from A to B
> Plan trajectory through waypoints
> Begin execution
> coninually scan for hazards and new opportunities
> Upon sensing hazard, stop execution
> Re-plan path
Etc etc
So for your cake-thief robot the sequence of actions would be something along the lines of:
GOAL: Feed the starving orphan children
> Deliberate plan:
> Plan route through high street
> Plan trajectory
> Execute
> Object recognition: Bob's Patisserie
> Plan Route to waypoint: Bob's Patisserie
> Spot cake, plan trajectory to cake
> Identify hazard: Bob, armed with piping bag
> Re-plan. Return later when Bob is not present
Etc etc.
The things is with robots, they are like small children. I can't say to my daughter "go and sit at the table" because she'll just end up with one buttock on the chair and the chair at a jaunty angle, and she'll bang her knee and end up crying. It has to be "stand up, go to the table, watch out for the paper on the floor, pull the chair out from the table - no, put both legs under the table, pull the chair in." A robot's the same; every tiny action has to be planned and executed in microdetail, because essentially they're pretty bloody stupid.