Hmm... I feel that both of 'при-' and 'под-' can equally mean 'close to' and dictionaries really mention this word as synonyms.
In my perception subtle difference is derived from prefixes. "При-" like in при-делать, при-стыковать, при-совокупить, при-ложить or even при-лететь means 'connected / close to / approach to target'. So it's 'to build smth close/connected to smth'. Normal usage for me is clear "zero-distance". So, I am perceiving 'пристроили сарай' as they share one wall.
'Под-строить' is very rare in usage, imho. 'Под-' is like 'from bottom'/'below'. It can be seen in под-делать, под-ставить, под-прыгнуть, под-держать. For me it's shifting meaning оf '-строить' to 'to be not only close to but also lower than' and 'to do auxilary, probably supporting role'. In this point of view barn is also do not fit to this well.