I don't recall the PS4 or XB1 being sold at a profit. Sure, the parts break down of the PS4 is estimated to be slightly less than its retail price, but there is R&D costs to consider for the next year or two.
As for Nintendo and the Wii U, having more games and better services would help it. Unfortunately, remedying the third-party problem (especially western third parties) requires time and money that is uncharacteristic of Nintendo spend. Arguably, paying EA and Rockstar to have Madden and Grand Theft Auto on the Wii U (or any Nintendo system) is probably not a financially sound investment. Personally, I think its a fifty-fifty chance of Nintendo wooing third parties back if they dump their war chest for them. As much as Nintendo is a frugal, conservative, and old business, so are a lot of third-party publishers.
As for online services, they are improving, alas at a glacial pace. I think a lot of the problems come from "Japan not knowing the internet" and Nintendo being an old, Japanese company (something Sony has moved away from with the PlayStation 4). It would be great if Nintendo hired a bunch of IT people under western direction to overhaul the Nintendo Network for the 3DS and Wii U. I just don't see that happening.
Nintendo is an old and ponderous company. It is slow to copy or follow and operates in its own bubble. Good and bad, that makes it a unique and interesting company that produces likewise products. Now, some of those products fall flat on their face, but that goes for every one. As frustrating as it is to see Nintendo be so slow and eccentric, it is what the company has built its successes and failures on.
An editorial on Nintendo described it as this: "Nintendo is a mountain, and the mountain does not move." I find that to be a perfect encapsulation of Nintendo's best and worst. Nintendo will not be going any where quickly. With the Wii U, I can imagine there is a contingency plan of a sub-25 million units sold life. Nintendo has the money and resources to try again. Nintendo, in the face of the culture of quarterly profits and success, can, has, and will wait.
The big question is: Can consumers and enthusiasts wait for Nintendo?
I can. I'm pessimistic on everyone else.