It is true that Hungary is very Budapestcentric, however in this particular case you can probably avoid westbound Budapest detour by getting off RO-HU train in Püspökladany (one of the first Hungarian stations after the Romanian border near Oradea). From there you can either take direct intercity train to Miskolc or go first to Debrecen (and already from there travel to Miskolc either by direct bus or train). The whole idea here is to catch one of two direct Budapest-Kosice trains in Miskolc (while then it's less than 90 minutes from there to Kosice & only 6,50 € for the ticket)
To help you visualize the route - here is
map of Hungarian railway network... though may be the quickest route?
Well, Püspökladany-Debrecen-Miskolc option won't be very fast, since you will be kind of stuck waiting Budapest-Kosice train anyways (those run only two times per day, morning & evening), but here you can spend most of the time not on the road, but enjoying short stopovers in very nice town Debrecen or Hungarian wine region (meaning instead of Püspökladany-Budapest...wait in Budapest...Budapest-Miskolc option)