When Bitcoin gets to a stage where the mined supply is basically 21m (that is, very little remaining btc left to be mined), will Bitcoin still remain a secure network?
I think this is a very advanced level of thinking. You know that the amount of block rewards is halved every four years, meaning that one halving is completed after mining every 210,000 blocks. If it continues like this, we will be able to continue effortlessly with Bitcoin till 2150 without any worries. It is hoped that by the year 2150, an alternative solution will be invented. So it is easy to say yes Bitcoin still remains a secure network.
That's a long way to go for bitcoin. So right now, we don't have to worry about such possible occurrence. And we don't even know by that time if bitcoin technology is still in use or already an obsolete. And most of us right now, will not see that day anymore.