Two years ago I spent a couple hundred more to buy a Dell laptop (over HP or Toshiba), because I had bought a Dell laptop that lasted for 8 years in the late 1990s. Well, it was trouble from day one - needed a new motherboard in the first month - and it finally crapped out on me for good this past week. I read along the way that Dells are made in a different location or with different parts now.
My solution, especially with technology, is to go as cheap as possible and just expect to replace it often. It sucks and is rather unenvironmental, but I don't know what else to do.
Not the route to go as there's still some quality electronics, but they're not exactly available through the normal consumer channels.
Dell still makes decent laptops, but they're all business/enterprise machines. The secret is to buy refurbished Latitude and Precision laptops. Same with Lenovo. Refurbished Thinkpad T/W/X series models, and Thinkpads have a strong user and fan base here. US Micro is a good source for either. Going Linux for the operating system helps, too. Code bloat with the desktop environment can be a far less serious problem on that end, as there's distros that target leaner system specs.
Desktops, build your own. Get a motherboard (and graphics card if needed) with solid polymer capacitors instead of electrolyte caps, use a decent Corsair power supply, and stick it behind an APC uninterruptible power supply (UPS) with auto voltage regulation (AVR). Use a WD or Hitachi hard drive if you go mechanical, Intel, Samsung, Sandisk or Corsair if you go SSD.
Cellphones are another front where used and lower end tends to pay off. You stay away from touchscreens and smartphones, and if you go with the older Nokia candy bar phones (with and without QWERTY keyboard), they'll wear like iron... these things can easily be picked up used for well under $100 depending on what you're looking for (most under $50). My old C3 is nigh indestructible. Also, any phone rated for IP67/68, or MIL-STD-810F/G can be reasonably stout as well, so long as it's not a slab smartphone... but the IP rating is a bit more reliable rule of thumb as there's standards compliance. Simpler the better. Samsung makes some rugged handsets.
Asus still makes decent routers, Arris/Motorola makes decent cable modems, both typically suffer the shortest lifespan at the power adapter. Replace that and they keep trucking. Not sure who's making decent LCD monitors these days, but a key secret is to keep the power adapter external, so look for power bricks. I've got an eight year old Acer IPS panel on it's second power supply, and no surgery involved to fix it unlike the bad caps on the internal power supply with the other monitors I've fixed.
We're at the peak of a consumer/disposable culture economy with planned obsolescence targeted across the board, but with careful and choice shopping on the electronics end, there's some ways around it.