All the Tor Hidden Services seem to be written in PHP or just plain HTML. If this is possible, is there any reason not to do it? How would one go about doing it?
Yes, you can use any tools you want to run hidden services. On the Tor Project's Hidden Service setup page for Step 1 you can use any webserver stack that suits your needs.
You can use any programming language for a hidden service. The reason why most of the hidden services using PHP might be the same why many services in the web use PHP. ;)
Your hidden service basically needs to listen on some TCP port. This can be for instance a webserver. Your application takes the request from that webserver and does something with it. You can also use the infamous Python example:
python -m SimpleHTTPServer to service sites via hidden services.
So basically you write your application like you did it using no hidden services. When you are finished, you just tell Tor to forward the requests from the hidden service to the service you are running:
HiddenServicePort 80 127.0.0.1:80. Each request which arrives at port 80 of your hidden service is mapped to port 80 on your machine. So when your hidden service also has a public address and serves the same service on that address, a client will get the same answer on the public way as on the hidden service way. It does not depend on programming languages.
The latest txtorcon supports endpoint-strings, so you can use Twisted built-in Web server to host any WSGI Web application (and twistd comes with SystemD support too). See here:
The command-line would look something like:
twistd web --port onion:hiddenServiceDir=/tmp/something --wsgi my.app.Main
(or just "onion:80" for the port to create a new ephemeral hidden-serivce with keys in $TMP)