Hello,
There's nothing mandatory :) but an unconnected terminal node like https://www.openstreetmap.org/node/12435743682 avoid this route from being used for routing.
if you wish, I advise you to connect them to a piece of sidewwalk that joins the pedestrian crossing or the road on either side.
Regards,
Marc