Keyboard and Touchpad stopped working - MacBook Pro 15" - Mid 2009

First off, you are running macOS Sierra on on an unsupported Mac. Per Apple's official supported hardware list, it supports MacBook Pros from 2010 and newer.

macOS Sierra was installed either by:

  • using some sort of "hack" to trick the installer into thinking it was supported hardware
  • installing it on a different MacBook Pro then moving drive with the new macOs installation into your MacBook Pro.

It's quite conceivable that this installation initially worked, but after an update, things would break because Apple is not anticipating that macOS Sierra is working on unsupported hardware.

The fact that it's working in a pre-boot environment, is a good sign that your hardware is good, though it's not conclusive. What you need to do is to revert back to El Capitan (10.11.x).

Run Internet Recovery CommandOptionR instead of booting from the Recovery partition. This will load the last supported OS. If your keyboard and trackpad works, then you have your answer.

What you will need to do next is to erase your drive and start with a fresh install of El Capitan.