If you are interested to do it in low level.
All data in chainstate files which is leveldb database.
Just iterate over all records in this db and get only records which are below your desirable blockchain hight.
can you share the steps to do this? I would like to try it but i have no idea what leveldb is or what tool you use to get it