Solidification of a ternary alloy liquid layer on a substrate subject to self-consistent melting