Some of the best fullbacks ever have played significant periods of their career in midfield: the likes of Paul Breitner, Junior, etc. Marcelo is probably the best attacking fullback of the last decade and his breakthrough season at Madrid was as a centre mid, and at around about the same time, Roberto Carlos was settling into a midfield role after years at left back. In more recent times you have a midfielder like Alexander Arnold breaking through at fullback.
It is one of the positions that historically there has been a lot of overlap with. If you go back to the early 50s there were no fullbacks, just centre backs and halfbacks. Halfbacks played a halfway role between what we now think of as a fullback and a centre mid. When the back four became common some of those players became fullbacks, some centre mids, and some occupied that half space.
Guardiola has effectively recreated that halfback role from the 50s. Alves sort of occupied it but he was so dynamic that he spent more time wider, while Lahm, Walker and particularly Cancelo went on to play a role that was neither fullback nor centre mid, but a combination of the two that was context-dependent.
Ultimately the quality needed to play either role is very similar in a lot of respects. Shaw could play centre mid just like Fred could play left back.