My headcanon is that in 40K, every machine really does have a "machine spirit", an AI capable of thought or feeling, because it was part of the STC plans twenty five thousand years ago, but ritual steps and blueprint embellishment disconnects them or covers the heat vents with prayer paper or wires them in backwards.
The occasional mischievous or helpful machine spirit is one where the ritual wasn't performed properly, and none of them are programmed to understand Imperial low gothic.