"Diaphonemes" are related to dialects, as you mentioned. Diaphonemes form a system that allows you to describe all of the phonemic contrasts in whatever set of dialects you are concerned with, even if no one dialect makes all the contrasts. A well-known example is John Well's lexical sets for British RP and General American: in RP, there is a split between TRAP and BATH, and a merger of BATH, PALM, and START; in General American, TRAP and BATH are the same, but there is a merger of LOT and PALM. Neither dialect distinguishes all sets from each other. But if we use a diaphonemic system, we can represent the pronunciation in both dialects using one set of symbols. Here's an ad-hoc example: /træp/, /baˑθ/, /pɑːm/, /stɑrt/, /lɒt/. Here, I used the allophonic notation /aˑ/ to represent a sound that corresponds to /æ/ in one dialect and /ɑː/ in another. (I haven't seen anyone actually use this notation for English in real life.) The phonemes in RP could be written as /træp/, /bɑːθ/, /pɑːm/, /stɑːt/, /lɒt/ and those in GA could be written as /træp/, /bæθ/, /pɑm/, /stɑrt/, /lɑt/.
The idea that "[pʰ] (as in pin) and [p] (as in spin) are allophones" in English doesn't really have much to do with diaphonemes. It's just about regular allophony, and as far as I can tell, the statement is mainly based on the spelling and historical development of these sounds, rather than dialect comparisons. The sounds are in complementary distribution (if we discount possible devoicing of /b/ to [p] when adjacent to voiceless sounds) which is a common condition given for describing a pair of sounds as allophonic.