Upvote:8
To make your BCN-LIS connection, you had to enter the Schengen Area, even if you stayed inside the airports. For this, you had to pass immigration - there was no way around that - and that's enough to make the two days count.
If you really need these days to not count against your 90 days in the future, you have to take a route that does not require you to board an Intra-Schengen flight (e.g. direct, via only a single Schengen airport, or via non-Schengen airports like London, Shannon, Moscow or Istanbul, to just name a few).