Engineering magnetic topological insulators in Eu5M2X6