Yes, Time Machine does restore a previous operating system but only if you restore from a Time machine backup without installing an operating system first. If you restore after installing an operating system, Time Machine will restore only personal files. In either case, it’s not possible to boot from a Time Machine backup alone.