Neither is actually 'illegal' in the sense of T11 automatic 20/80 possession.
GK in midfield is just an oop. Most likely result may be some player quality penalty (no way to quantify) and morale loss (observable)
MC (or other) in GK spot can *sometimes* result in 20/80 possession, but not always - never happens in tests, but has been observed many times in games. No idea why or what other specific factors trigger the possession penalty in that case.