Two different voltages from a single transformer without a common ground
Yes, it’s fine.
Of course you would need flyback diodes across the relay coils and probably a driver circuit to get enough coil current reliably.