I am not a lawyer, I am not your lawyer, I am not even from the UK.
Barring a UK specific statue, we turn to the Common Law, wherein Theft is the crime of:
1) The unlawful taking and carrying away of
2) Someone else's property
3) Without the consent of the owner and with
4) The intent to deprive the owner of the property permanently
In order to be theft, all 4 points must be met. In the case which you described actually happening described, elements 2 and 3 are clearly met. However, 1 is still debatable, and it is generally assumed that in this situation, as described, 4 is false.
1) Is it could or could not be lawful for the security guard to detain you and search you possessions. Certainly I've seen signs on stores claiming this right, but these are not necessarily legally accurate. So stoping and searching may or may not be lawful depending on the specific statues of where you live.
4) Assuming that the security guard is "acting in good faith", or doing what is right, proper and expected as a security guard (one might call it "just doing his or her job"), then the security guard has no intention of depriving you of your property permanently. He or she would merely intend to deprive you of the store's property permanently, or detaining you until your property is verified as such
(In my experience, receipts are always issued at any place that has a security guard, and are a good, quickly verifiable means of establishing that "this stuff is my property").
In the theoretical case you described, in addition to the above, point 3 would also probably not be met, as your leaving the bag could be construed as consent, as you are the one leaving.
In summary, no, I don't think it would be theft.