Nintendo knows how to make good hardware, they've been doing it for over 2 decades, but their current management just doesn't seem to get it.
The definition of 'good hardware' has changed dramatically over those two decades. And in two decades, we're talking 6 devices. NES and SNES were great for 2D consoles. N64 was okay, although it had issues that made it far from a fabulous design, but then all 3D hardware was pretty ropey back then. Still, Sony made an easy to develop for, 3rd party friendly platform which is what took the crown cleanly from Nintendo. GC was also okay, thanks mostly to the ArtX GPU I'd say, but despite being a good little box, Nintendo couldn't compete and just managed to eek out a decent niche selling to their fanbase. Wii was a great idea that went gangbusters, but the hardware design itself was still pretty poor - they could have provided much better specs and a wider appeal. They also failed to get the 3rd parties on board in a big way (principally due to it being last-gen hardware). Wii U is another box was bad from the get-go on paper.
So I don't think Nintendo are well versed in making good hardware, and they are definitely poor at attracting and keeping third parties which is necessary for a healthy all-round gaming machine. They are also crap at online services and don't seem to care to learn. the end result is an expectation from the likes of me that a Nintendo console will be poor VFM in terms of hardware, have ropey services, and won't have many of the games I'd like. If many gamers are the same as myself, they will only buy a Nintendo console for N. franchises, and that's where N. have locked themselves into a niche.
Although they have managed to make good money on their hardware when its worked, N. have mostly been kept afloat by their peerless handhelds (which actually benefited from N.'s poor-specs mentality because it saved battery life!). I don't believe N. will make more money from 25 million buyers of $50 games than they would by getting $20 from $60 games selling to 120+ million console gamers along with $4 a game from 1 billion mobile gamers along with $10 per month from rapid mobile consumable buyers, without even factoring in the savings in not designing and producing their own hardware.
As for your reference to Sony and MS producing closed boxes, neither really likes them and both would rather have a software platform, and both are taking steps in that direction. Console hardware is a pretty poor industry in terms of returns, and it's only the few runaway successes that give it any appeal at all.