In real-life, locomotives were expensive to scrap, so it was cheaper to abandon them on disused lines. Sometimes bricking them up in tunnels was a way to avoid them being found and being fined for not properly disposing of them. Awdry was probably asked by one of his children "why is that engine bricked up in a tunnel?" and he probably answered "because he was naughty and that was his punishment."
15:33 I Think The Human Equivalent Of Bursting You're Boiler Is Bursting You're Heart. Without A Boiler Steam Engines Can't Function Right? The Same Thing Goes With Human With Our Hearts.