Is a fly-by tower legal for civilians not during a show?
No, that is not legal.


  4.6 Except when necessary for take-off or landing, or except by permission from the appropriate authority, a VFR flight shall not be flown: [...] at a height less than 150 m (500 ft) above the ground or water.


(ICAO Annex 2)

So unless you are taking off or landing (which you are obviously not, if you are right next to the tower), you are not allowed to fly below 500 feet - and control towers are not 500 feet high.

(The quoted rule is for VFR flights, which I consider to be on topic since you are asking about "a small plane, like a Cessna 172". Similar rules exist for IFR flights, but those are even stricter)