A first-of-its-kind study in Canada has revealed that building new homes in flood and wildfire-prone areas could cost billions and threaten affordability.