Is it possible to migrate from Back4App to self-hosting?

Yes. For database, your MongoRocks database is always accessible. You can connect to it at anytime using any MongoClient and make a dump of it and restore this dump wherever you want. For Parse Server, it is now open source. You can get it in github and install in your own server