It's not a problem if he marries, why would it be ? ( I assume you mean how would it affect his ownership of the flat. I would have other concerns about any of my children marrying as teenagers but that's another matter ).
And if he and his wife divorce, there would be a charge over the value of the house ( a loan which needs paid back like a mortgage ) so only the capital gain would be a marital asset. And that's assuming that she would get Part of it from a short marriage, which would be unusual.
If he doesn't want to sell after 4 years he can remortgage and pay me back the loan, as he will be working by then. But I suspect he will want or need to move away for his career.
If he drops out he can contuine to live there if he wants and get a job in that town. Or sell up or rent out.
If he changes unis we can sell or rent out.
These are all the same options that are open to anyone who buys property. If your life changes or your need to move location, there are associated costs. It's one of the down sides.
What does he want ? He wants to live with a few friends of his choosing and get on the property ladder. And stop spending £5k pa on rent which adds to his debt.
Loaning your child money to buy a property is what many, many parents do. Most first time buyers rely on the bank of mum and dad. It's not tax avoidance.
And even if it were, tax avoidance ( arranging your affairs to minimise tax ) isn't illegal. It's tax evasion that's illegal - not paying the tax that you owe.
The advantage of this is that it makes c. £11k pa from an investment of £150k with no risk to the capital. As well as providing somewhere decent ( safe, clean , convenient ) for DS and his mates to live. And gets him on the property ladder.
House prices in slow increase areas don't drop much either.
I'm sorry you had such a bad experience of buying your first home.
Thanks for your comments, it was helpful to think these things through.