Macbook Pro 8,2 Crashing During Login Specs:

Early 2011 15" Macbook Pro (Sierra).


RAM upgraded October 2016, 16GB Corsair
SSD upgraded July 2016, 256GB SanDisk
Battery replaced January 2016
Logic board replaced February 2016 (replaced as result of qualifying for the gfx card recall.)


Basically a year old computer 

Problem:

Yesterday it started crashing while signing into a user account -- while connected to power. The flow is as follows:


Boot (Grey screen with Apple logo)
Display user accounts
Sign in to user's account
Sign in progress bar
Crash at ~1/3 complete progress bar
Reboots automatically


Background:

Over the past 1.5 months the battery has become seemingly defunct.


Initially, it would crash after ~2 minutes of use after waking from sleep and running off battery. It would need to be connected to power in order to start up successfully.
After about 2 months of this, it began crashing while running off battery regardless of whether or not it had woken from sleep.
Now it (usually) crashes within seconds if the charger is disconnected.


When I went to the Genius Bar I was told it may be a bad battery. It passed all of their diagnostics, however, it seemed to heuristically lose charge quickly and the capacity came in at over 100% -- which is only expected from batteries right out of the factory.

This all seemed like a case of a bad battery until yesterday. Maybe these issues are not connected... but seems like they could be.

Troubleshooting:

So far I've tried:


Tried 4 separate properly 85W MagSafe chargers. Same results.


So it's not the bad battery.

Booted from an external bootable drive (running El Capitan). Same results.


So, not an issue with the SSD nor corrupt OS (I think. Booting from an external drive should bypass the internal drive completely. Yes?*)

Ran the extended hardware test. No issues found.


So, not an issue with RAM. I am going to try and run memtest if I can get access to a shell.

Left it idle for ~15 minutes at the login screen. Does not crash.
Spent ~15 minutes in the guest account (the safe account -- only Safari access) and messed around. Does not crash.
Spent ~2 hours of time in the "BIOS" pages. Hardware test, Disk Utility, etc. Does not crash.
Booting into safe mode (Cmd + S) displays BuildError(): error building a user of type


Hypothesis:

It seems the issue is occurring when the boot program is loading the OS. I don't know a ton about how things work at this level, but my guess is the logic board is the culprit and is failing during this handoff.

Questions:


Any ideas?
Could a bad battery somehow bust up power management -- or is it entirely isolated whilst connected to external power?
Have I done enough to rule out corrupt software, SSD, and RAM?
This question is an excellent example of the unintended consequences of not addressing a small issue (bad battery) and having it create new issues (crashing).

While it may appear that a bad battery and a crashing hard drive are mutually exclusive, they, in fact, are intrinsically linked.  This however, doesn't preclude the possibility that their are other issues at play, but in order to address efficiently and accurately, you have to eliminate the initial problem.

The Battery

You have a at least an 18 month old battery assuming it was "brand new" when you installed it and not sitting around in a warehouse for a few years prior to your purchase.

Your battery reports its remaining capacity based on a calculation of certain variables - the current voltage and the draw.  It can't measure the batteries ability to hold a charge.  So reading a battery that says 100% only means it's 100% at that moment.

Sleeping on a Dead Battery

When your MacBook Pro detects a low battery condition, it will put the MacBook Pro to sleep.  Going to sleep powers everything down except the RAM;  its current state is kept in RAM so you can quickly resume right where you left off.  If your power gets low enough, it will go into hibernation mode writing the RAM to disk.

If your battery dissipates so quickly as to not allow this state to be saved, you run the risk of corrupting data (and not just your pictures of cats and toasters, but data critical to macOS).  This sounds like the issue you described.



Troubleshooting


Eliminate your battery from the equation.  Disconnect it from the logic board.  Remove the back cover and using a plastic tool (like a spudger) remove the battery connection. Your MacBook doesn't need a battery to function.  You don't need to replace the back cover for the next step, just be certain you are not putting the MBP on a conductive material.  You can put it on a towel if you want.


Check the health of your SSD.  Boot into recovery mode, and run the following commands to check the SMART status of your SSD:

$ diskutil verifyDisk disk0
$ diskutil info disk0 | grep -i smart


Most likely, you will get "Verified" with the last command meaning your SSD is good.  Anything other than "verified" consider getting a new disk.

If everything is good, you can move on to fixing the login issue




Fix Login Issue


Create a new user in Terminal.  Boot into Single User Mode and then issue the following commands

fsck -y
mount -uw /


What you are doing is checking the drive and then mounting the / volume as read/write.  To create a new user, follow the instructions already written up in this post being sure to adjust the values for your specific needs.  Reboot by typing reboot

If you can log in with this newly created account, you corrupted your User Profile and your best bet is to use this new account and/or create another one.

If it solves your issue, you can skip to step 3.  If you can't log in, continue to the next step.
Reinstall macOS.  Operating under the assumption you have made Time Machine backups, reinstall the OS.  Migrate your backed up data using Migration Assistant.  
Run your Mac, but don't disconnect the power. (you're not on battery, remember?) Use your Mac as you normally would.  If you have no problems, then the issue of it crashing is solved.  
Replace the battery.  If everything works, you would have resolved the login crash issue and narrowed down the cause to the failing battery. See this Answer:


  When they [batteries] do die, it's always best to get a good quality replacement
  battery from a reputable manufacturer. The 2006 MBP uses an external
  battery so it's fairly easy to find replacements - and some even come
  with generous warranties.


Even though it's written to address a 2006 MBP, the explanation and recommendations are still valid and relevant.