Banks are designed to be good at evaluating loan applications. They aren't designed to be good at running businesses. And if banks decided that they wanted to get into the apartment rental business, the government would prevent it.
The person renting out the flat has to advertise it to find potential tenants. They have to show the flat and evaluate potential tenants. They have to deal with repairs and maintenance. They have to deal with tenants that fall behind on the rent, that stop paying rent and need to be evicted, and with tenants that damage the flat. They have to deal with months where the flat is empty. Those things realistically mean that the landlord is making less than the 5.6% you're quoting. But it also requires a host of skills that the bank doesn't have. Of course, the bank could outsource most of these tasks and just supervise some property management companies but that's further cutting into the potential profits and that still requires a bunch of managers that the bank doesn't have.
Of course, banks do far more than just real estate loans. They're going to give loans to the person that wants to open a car dealership, to the doctor that wants to open a practice, and to the businessman that wants to open another McDonalds franchise. In theory, the bank could be in the business of managing a car lot and a medical practice and a fast food restaurant in addition to renting out apartments. But it is terribly unlikely that it would be good at all these things.
Practically, if a bank decided to get into one or all of these businesses, they would almost certainly encounter legal troubles. If the government is going to insure bank deposits (which is close to universal), they're going to want to ensure that banks remain solvent. If banks started running a bunch of businesses rather than just making loans, there would be a large risk that some banks would run their businesses badly and lose those deposits meaning that the government would have to bail them out. That's very different from a rental company that can go bankrupt if it mismanages its business and only lose the money that investors have risked. It also puts the bank at an unfair competitive position-- they're running the business with money the government guarantees while a regular apartment rental company is running the business with money that the investors are risking. I can't say that every country already has laws that prevent banks from operating businesses like this. If a bank decided to try to get into a business like this, though, and a country didn't have an existing law, it would almost assuredly pass such a law.