To get to Keshava temple from Bangalore I need to follow the Bangalore-Mandya, Mandya-Bannur, Bannur-Somnathpur route. Then I'm wondering since it's more of the same direction to Mysore, can I also go to Mysore afterward and take a night bus/train back?
Yes you can actually I come from Mysore, and the temple is just 30+ km's away, and good express trains to Bangalore are available till 20:30
Let me know if you need anymore information.
We did it in one day. We took a train to Mandya from ERN at around 9. It arrived at 11:30 (it took longer due to the delay) Then from Mandya city we took a direct public bus to Somnathpur. We arrived at around 1:40. Then from the temple we took first a bus to Bannur then from there it was easy to jump on a bus to Mysore. We only did the palace in Mysore and then take a train at 6-ish and arrive at 9-ish in Bangalore. In Bangalore we still went to the night food street.
It was quite a day but easier than we tought. For the same we also did a day trip from Kochi to Kottayam, did a backwater public boat to Alleppey then took a bus bck to Kochi from Alleppey.