In some countries there are mandatory rules for new buildings. Most experts would tell you that they failed spectacularly. For a time styrofoam was recommended. Today you have difficulties to dispose that shit again.
> Why is it still legal to rely on fossil fuels for heating for example?
Because there are few alternatives. You can use wood, but that comes with its own problems.