I have a solution.
1:- while flashing rom wipe system dalvik cache and cache but dont wipe data .
2:- flash the rom and let it optimize apps .
3:- after optimizations most probably you will be in bootloop , simply boot into recovery and wipe data and reboot.
4:- your phone will optimize apps again and this time it will boot up and you can access sd card as adopted storage without need to format it again as internal.
This trick worked for me and should work for you guys too.
There's another method that is :-
1:- navigate to root folder
2:- copy all the files from data/misc/vold to somewhere in SD card
3:now boot to recovery wipe everything except SD card and flash new ROM .
4:- now using twrp's file manager move the files you from step 2 to the same folder I.e. data/misc/vold