While that is in principle true, in practice there are quite a few issues. Many heatpumps here are made to heat the water for floor heating but don't transfer heat to air indoors. So you would cool using your floor which isn't very comfortable usually. More importantly because of the above the heat pumps are build for only one directional transfer. If one builds their own system it might make sense to plan for it, but even then it's unlikely that Sweden will become so hot that opening windows will not cool off the house enough. If it comes so far we likely have more pressing problems.