Nintendo didn't return to profitability until the Nintendo Switch. With the exception of FY 2014, Nintendo lost money from 2011 to 2016. This is probabloy the longest the company had gone with consecutive net losses. The 3DS was an adjunct failure and was the cause of Nintendo's financial difficulty. It's also Nintendo's worst selling handheld. So Nintendo focusing on 3D lead to Nintendo becoming unprofitable and trashing the company's handheld line.
I think the 3DS in its own right was profitable for Nintendo after the first few years, otherwise it wouldn't still be on the market 6-7 years later. Other things IMO were contributing to Nintendo's losses after fy 2014. Having to develop a brand new system so quickly after a failing one (Wii U), Nintendo has never had to do that before. I'd imagine development costs for Switch's 4 juggernaut launch year titles would've drained them as well.
Though I do think 3DS somehow contributed to Wii U's eventual failure. Nintendo pumped so much money into saving 3DS that they probably weren't willing to do the same all over again for Wii U. They kinda just hung it out to dry it seems.