Remember that a 40% rise in median price (as much as I hate talking about an irrelevant median figure), doesn't mean that everyone has to have that amount of debt for it.
70% (from memory) of the housing market is Owner Occupier - amazing since houses have been so unaffordable isn't it? Anyway, back to your question and my point. You asked who can buy it if the price is 40% higher in 5yrs?
Scenario: Joe & Jane who bought their first home in Salisbury (replace with cheap suburb in your city) last year at 80% LVR, and are making payments diligently - perhaps even paying a bit extra. By the time 4yrs comes around, their house has risen 40%, and they have meanwhile paid off a decent chunk of the principal. Hey presto their LVR has fallen to 50%. They now decide to upgrade their PPOR to a more expensive suburb which has also risen 40%, but they push their debt back up to 80% of the higher price. Wanting to keep up with their friends Bob and Sue - they do the exact same process again in another 5yrs at which point they have got their dream home near the beach.
Now this is a very generalised example without figures - but THIS is who will be buying in 4yrs time. These type of buyers are quite common in today's market (and always have been). Not all buyers are a) new to the housing market, b) expecting to buy the median house first, c) fit neatly into the income/debt/median scenarios.