The idea is interesting but unfortunately most of the people don't know the electricity price even now without this mechanism.
This should be displayed on top of every washing machine everywhere to make it works
In practice having the machine heat the water is usually a good choice because the machine already wants to take a set amount of water and heat it to a specific temperature (based on your chosen programme, silk knickers obviously do not want the hot water you use to clean cotton bedsheets after your youngest didn't wake up in time) whereas your hot water boiler just makes arbitrarily hot water forever.