Where I'm from the shortage of supply is also due in varying proportions to: too many airbnbs and secondary residence, rural flight, families being split in multiple households, increase of average home size, etc. Immigration certainly plays a part, but likely not as much as you think.
Biggest cause is insufficient increase in supply, often due to government regulations.
Immigration can heavily increase demand, and so it can play a big part, depending on the immigration numbers. Anyone moving in needs a place to live as well.