That original question was based on erroneous assumptions. Most of the answers refer to it being questionable.
For starters, there are many, many different scales, the well-loved major being only one.
Scales are our way to label notes - to pigeon-hole them. It's what humans do, and like to do! It could be argued that chords can be made from notes of any scale - they actually are. Especially the chromatic scale, which happens to contain all the notes western music uses (except those bent by guitarists!).
It just happens that with chords, the notes involved can be seen as having intervals between them, so it's one way to establish how certain chords are spelled. As in Dm has a m3 and P5, or Cm7 has m3, P5 and m7 (all calculated from the root).
From what you've stated, we can't get a Cm chord from the C major scale notes - we can from the C minor scale notes, though.
Not all chords can in fact be made up from diatonic notes. C diminished 7 only has one note from C major. It also can't be made from the Cm scale.
On to your question. A piece in, say, key C major will have most of its chords made up from the diatonic C notes. There will be times, though, when other notes need to be used, and that will probably mean using other chords. If there's an A♭ note in the melody, an Fm chord will fit. If it's a G♯, then it could be that C+ is leading to an F chord, so Caug. will fit.
However, with less complex tunes, the diatonic notes will fit the diatonic chords, and vice versa. When I have to solo in B♭, my first thoughts are based in the B♭ major scale notes. If it was a B♭ Blues, I'd be thinking in terms of the two B♭ blues scale notes.
Appertaining to your last question, have a look at many songs. Notice that any bar with a particular chord being played in it will most likely have at least a couple of those same notes in the melody. It's pretty straightforward - the chords fit the melody line, and the melody line fits the chords. That happens most of the time - if it didn't something would sound wrong! I'm not saying that in a bar of C the only notes that will fit will be C E and G, but generally speaking, at least one of those notes will be in the bar - often in a prominent place - 1st or 3rd beats, for instance.